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 / runtime Error in code

Author
Message
Mr Inquisitive
20
Years of Service
User Offline
Joined: 5th Feb 2005
Location: Who Cares?
Posted: 4th Apr 2005 07:42
In this code there is a runtime error. It says that "BOB DOES NOT EXIST" What does that mean and how can i fix it?

Horus Game Developments
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 4th Apr 2005 09:36 Edited at: 4th Apr 2005 09:38
Mr Inquisitive,

The problem lies within the piece of code which checks for collision of sprites 24 and 4. Once the sprites collide for their first time they are both then deleted. Though, they become deleted, your code is still setup to check if they collide. This is what is giving you a runtime error. A BOB is a SPRITE, and if you check collision for a sprite that no longer exists, you are given the runtime error.

So, to fix this problem, take your section of code which checks for collision, and enwrap it in a blanket of code which first checks if the two sprites exist anymore. Try this:

This will keep you from that nasty ol' runtime error. You will not recieve a runtime error for checking if the sprite exists. However, you will recieve a runtime error for trying to use or manipulate a sprite which does not or no longer exists.

+NanoBrain+

Login to post a reply

Server time is: 2025-05-23 12:46:37
Your offset time is: 2025-05-23 12:46:37