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 / need help with a command

Author
Message
Barbarian
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location:
Posted: 12th Dec 2006 02:33
Hi, i recently bought dark basic professional (like 2 days ago) and i've been going through the 2d/newcomers forums, reading the tutorials. I just started making a 2d shoot-em-up game using the tutorial in the 2d forum, and i feel like the way i'm writing this is too chunky and i have some unneccessary things. But my main question is, is there a shorter way of writing:

"if sprite exist(21)=0 and sprite exist(22)=0 and sprite exist(23)=0" etc up to "and sprite exist(30)=0"
Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 12th Dec 2006 03:34
Well, you could do this:



common people are walking in line.

Mitsu Fly Ride.
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 12th Dec 2006 05:42
yeah, open_Froz used what's called a for...loop, what it does is loop through checking from one specified number to another. For example:

would be a simple example. You could take that a step further and do something like open_Froz did with your code to simplify things as well . The x represents any variable that you create, so it could be named anything, as long as it doesn't include spaces. The rest I think is self-explanatory, if you need any more help just ask .

Pirates of Port Royale
Live the life of a pirate.
Barbarian
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location:
Posted: 12th Dec 2006 08:23
thank you, both of these suggestions were very helpful

i've got another question, i decided to redo some bits of my game as they were unneccessary, and i was just wondering if there is a way to unload images after they've been used, and if this would help speed up the game in any way
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 12th Dec 2006 21:22
delete image ID

Login to post a reply

Server time is: 2024-11-27 01:41:29
Your offset time is: 2024-11-27 01:41:29