Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a problem...
#1
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.
Sad Can anyone help with this?
-p
Reply
#2
types are not useful unless you are doing bitmap load.save stuff Smile

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.
Reply
#3
Quote:types are not useful unless you are doing bitmap load.save stuff Smile

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.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#4
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.
Reply
#5
:|
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.
Reply
#6
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
Reply
#7
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
Reply
#8
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)