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.

Code Snippets / DBPro Helper Functions

Author
Message
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 30th Aug 2006 07:25 Edited at: 30th Aug 2006 07:26
I just have a few quick things that I use to reduce the number of times I write the same inane code...nothing spectacular, they just help you do your job, that's all. They are not guaranteed to be robust, but I try to write code that does not bite me later.

The first two are functions for getting the next available image and object.

GetNextImageID()


GetNextObjectID()


I hope they help. Certainly, I think it could be applied to other function calls, so be sure to find other places to use the templates!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 30th Aug 2006 22:58
Quite a lot of DB users use similar code.

You can simplify the code a bit;



Boo!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 31st Aug 2006 00:18
I do it differently than most people.




The reason I do it like this is because if you use the traditional method, it wont work if you do lots at once, i.e.

player=freeObject()
enemy=freeObject()
building=freeObject()
make object .....

or even

for x=1 to 10
object(x)=freeObject()
make object....
next x

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Aug 2006 01:33
Zotoaster I can still make multiple objects using spooky's way:




Mickm
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Kingston, ON
Posted: 31st Aug 2006 07:39
Sixty,

He means if you use ObjectID's as variables



Thus it will fail on the 2nd MAKE OBJECT because spooky only checks if it is created. Thus in the example it wasnt created before calling another FreeObject()

Online Flash Games and Guides .::. http://www.gamestack.org
Online Notebook .::. http://onlinenotes.gamestack.org
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Aug 2006 20:12
AH I see. Thanks.

Login to post a reply

Server time is: 2024-11-23 03:15:35
Your offset time is: 2024-11-23 03:15:35