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 / Help With Simple Code

Author
Message
Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 6th Apr 2003 02:37 Edited at: 6th Apr 2003 02:41
Here is the code:


In this simple game, you control a sphere that is falling at a constant rate. The object of the game is to dodge all of the cubes. I want it so that when the sphere passes the first group of cubes, it destroys them so the game does not lag when the next batch is created. I have tried to do this, but there is an error. The error occurs at line 44, it says that the object doesn't exist. Please help me, I have tried to fix this problem by myself but I cannot seem to do it. Thanks, I have the trial version of DBPro, so there is not tutorial I can go to to get help.

xtom
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 6th Apr 2003 04:03
Well first of all I'd write this bit like this

If Object Position Y (10)<-10000
for x = 11 to 300

rem - ERROR ORIGINATES HERE -
delete object x
rem - ERROR ORIGINATES HERE -

next x
endif


and then you'd need to position your sphere back to the top and create more objects to replace the ones you just deleted. Maybe something like the following?

xtom
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 6th Apr 2003 04:09
I remed out one of your collision lines in that code btw. Also it's not a good idea to delete or create objects on the fly mid game as it can take a fair bit of time to do so. Your better only creating and deleting objects when loading a new level for example.
Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 6th Apr 2003 04:12 Edited at: 6th Apr 2003 04:14
Thanks for your help! It works perfectly now. And, if you don't mind, how do you create new levels? I'm really new, so I don't know a lot of the basics yet. Thanks again.

Login to post a reply

Server time is: 2024-09-20 03:54:11
Your offset time is: 2024-09-20 03:54:11