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.

Newcomers DBPro Corner / Making an object.

Author
Message
Andy Hamm
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: United States
Posted: 30th Nov 2009 09:48
In BlitzMAX to make a 2D object you write

What is the way of making a 2D object that can have instances of itself in DarkBASIC?

- By the way I do not know BlitzMAX I just have a bud that was trying to help me understand objects. They use Blitz.

Please visit my site: http://www.andygames.com/
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Nov 2009 10:19
You can't have objects (classes) in DBP. You can however have types (structs). The syntax is actually the same that you wrote up there.

Something like this:


Take note that you can only have fields, and no methods (functions) in the types.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 30th Nov 2009 15:38
Quote: "Take note that you can only have fields, and no methods (functions) in the types."

Nor arrays, sadly.

Andy Hamm
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: United States
Posted: 1st Dec 2009 02:00
So would types be used to create a sprite class? Like for instance, make the rules for 1 sprite but be able to put multiple copies of that 1 sprite on screen and have them act separately. (But following the same rules? Let me know if I am not clear.

Please visit my site: http://www.andygames.com/
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 1st Dec 2009 06:46
Quote: "So would types be used to create a sprite class? Like for instance, make the rules for 1 sprite but be able to put multiple copies of that 1 sprite on screen and have them act separately. (But following the same rules? Let me know if I am not clear."

You'd have to program all that by yourself if I understand this, sure you could put this data in a Type, but it won't have any effect unless YOU write code that actually does something with this data.


EDP Map Editor[2D]
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 1st Dec 2009 22:16
Andy - for the love of everything holy, please please please do something with your website! Darkened, tiny red text on a black background... my tired old eyes can't focus!

Login to post a reply

Server time is: 2024-11-24 23:14:57
Your offset time is: 2024-11-24 23:14:57