Posts: 35
Threads: 19
Joined: Mar 2003
im still learning...slowly getting better learning from mistakes etc.
iv just learned how to define objects using the :
Code:
TYPE atype
A AS INTEGAR
B AS INTEGAR
that kind of thing, which i am using for a simple battle type game where u can select a pre programmed character with unique stats which to keep simple i am only using HP and Damage, thus the two integars in the example. What i need to know is how to call on those integars when writing an expression.
What i want to do is have type1's damage integer taken away from type 2's HP. Im not sure of the proper syntax to get this to work.
Can anyone help with this?
-p
Posts: 3,368
Threads: 195
Joined: Jan 2003
types are not useful unless you are doing bitmap load.save stuff
Listen, just use a.hp and a.damage. You don't need type.
n = 100 'amount
DIM a.hp(n) as INTEGER, a.damage(n) as INTEGER
i = 56
a.hp(i) = a.hp(i) - a.damage(i)
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:types are not useful unless you are doing bitmap load.save stuff
Listen, just use a.hp and a.damage. You don't need type.
n = 100 'amount
DIM a.hp(n) as INTEGER, a.damage(n) as INTEGER
i = 56
a.hp(i) = a.hp(i) - a.damage(i)
But using types is better. If you have to pass all those values to a SUB, you only have to do
Code:
SUB dummy(a() AS mytype) ' this using types
instead of
Code:
SUB dummy(a.hp() AS INTEGER, a.damage() AS INTEGER ... ... ...)
TYPEs are one of the most useful things in QB.
Posts: 704
Threads: 0
Joined: Dec 2002
a user-defined type when loading or saving a bitmap.
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 3,368
Threads: 195
Joined: Jan 2003
:|
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 2,020
Threads: 24
Joined: Jun 2002
i'd have to say bitmaps are more of an array/allocated memory page thing. type arrays are for making your program more organized, efficient and humanly comprehensible.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Posts: 1,845
Threads: 44
Joined: Aug 2002
Argh, I don't even use types for loading and saving bitmaps. Since the header of the BMP contains lot of nonsense, you can just do
Code:
DO
l& = 0
GET #1, , l&
LOOP WHILE necessary
very often
Posts: 838
Threads: 17
Joined: Jan 2002
I agree that types are a good thing, unless you use string, because they have to have a predefined length. That sucks :barf: .
Im guessing that the solution is to use types if you have many values, or need to have many of many values (Cryptic, but like NPC's, you create a template using type, and DIM as many as you need.). Else you should use normal variables, and maybe group them like Agamemnus said.
/Zap
url=http://www.copy-pasta.com]CopyPasta[/url] -
FilePasta