Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / How do I give a object 'properties'?

Author
Message
Bop
14
Years of Service
User Offline
Joined: 13th Jul 2009
Location:
Posted: 13th Jul 2009 11:37
In languages like C++ I can put more than one object in a group,
they all have the same thing in that group.
For example, I want to make more than one bullet which explode when he hits a cube. The cube dissapears. I want to give the bullets a 'property', because the cube mustn't dissapear when he hits a wall.

Hey
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Jul 2009 12:13
There are several ways, though none built in. My preferred solution is just structure your object numbers. For instance:





These can then be checked for specifically with If-Thens like so


You could also use arrays to store data, but it would probably be best to do both (structure your object numbers and store properties in an array).

Make sense?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 13th Jul 2009 15:11
not to me.

Aren't you just using the arrays to store the 'properties'...?

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 13th Jul 2009 19:11
yeah bn2's method will probably work the best

also be careful when using the terms C++ and object in the same sentence, in plain C++ there are no 3d objects, an object is the term given to an instance of a class

(a class is basically a list of variables, when you create an instance of a class you are basically sayng: "take all the variables regarding the class and make copies that refer to this new instance")

its only when you add DarkGDK to C++ do you get access to 3d objects, so I recommend that when you are talking about 3d objects in C++ to make sure you call them as such rather than just objects

and in case you havent figured it out, I am learning C++

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 14th Jul 2009 00:05
Arrays store information to interpret the properties, and you COULD create an array of size 65535 and individually store info for each object. It would be better to have it be size 10 and have them be different type of 'object'. So you would have 10 sets of "rules" to be applied. Depending on what the object number is that the cube collides with, it will select the appropriate set of rules.

By structuring your media numbers (images, 3d objects, sprites etc) you can do smart checks, where you check with category the number (which object the cube is colliding with) is in.

I feel like I am just talking in circles and making it more complicated sounding. Help me out a little and tell me where you are lost (or if I made sense thats cool too)

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 14th Jul 2009 00:13
how about some code?

Login to post a reply

Server time is: 2024-05-20 10:33:12
Your offset time is: 2024-05-20 10:33:12