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 / Promblem with loops and deleting objects

Author
Message
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 15th Jul 2009 08:47 Edited at: 15th Jul 2009 09:17
OK this is the final promblem with my game before its ready for the W.I.P forum. This code and promblem is sort of messy but i will try to explain it the best i can. First im going to post a photo and the code.
Ok the point of this game is to collect the asteroids within the time limit. Now object 152 or the sphere is the player. The promblem is when the player collides into the asteroid i want the asteroid to get deleted,but in the loop the asteroid is gettinggn checked for collision with the sphere so when the asteroid gets deleted the game crashes because it says object does not exist. I already tried the repeat until loop but that doesnt help because it turns of collision detection after the first asteroid collides with the sphere. Hiding the asteroids wont work in my case so does anyone have any solution. Please help this is my last promblem. Thanks so much.


THis is the code specifially for the collision detection before the asteroids and the player.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Jul 2009 09:07
You can check if the object exists before you check for collision. If you do it that way you shouldn't get an error because it'll skip the collision check if the object doesn't exist.



kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 15th Jul 2009 09:18
Ok Grog thanks so much. Never thouht such a simple command could be the solution to suck a headaching promblem. I edited the post and deleted the code i had posted. It was my whole games code and i didnt want a new person to steal it. Well issue solved thanks once again.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Jul 2009 19:11
Np.

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 16th Jul 2009 08:25 Edited at: 16th Jul 2009 08:27
timing is essential in programming, it may take time to realize it, but you should always do your update commands last, and your delete commands near the end. Also a tip, when you program program in this order:
Load Commands
Process input/Calculate
show screen
loop
delete all objects

Login to post a reply

Server time is: 2024-11-25 04:21:49
Your offset time is: 2024-11-25 04:21:49