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 / arrg stupid sprites!

Author
Message
Vesper103
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Beloit WI
Posted: 1st Mar 2008 01:14
okay in this code:



im creating 100 enemy sprites, a counter gradually increases and once it reaches a certain value the enemy is shown. but i keep getting an error that the sprite does not exist at the denoted(--> line. any idea why?


D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 1st Mar 2008 02:09
Try this:

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Mar 2008 04:46
Since you have already checked to see if the sprite exists, you don't actually need to check again. With the Else added, you know the sprite exists at the point the error was occuring.

Also, a minor point (only mentioned because I know you are currently into optimizing) is that if the sprite is being deleted, then the previous positioning of the sprite is a wasted exercise.

So, moving it to the Else section only positions the sprite if it hasn't been deleted (when either l1burtshp(n) or the sprite's X position becomes less than zero).



TDK_Man

Vesper103
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Beloit WI
Posted: 1st Mar 2008 05:08
wow thanks. TDK you rock!


Login to post a reply

Server time is: 2024-11-25 07:53:38
Your offset time is: 2024-11-25 07:53:38