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 Professional Discussion / Carbonade Broken Program

Author
Message
rookie4407
11
Years of Service
User Offline
Joined: 9th Oct 2014
Location:
Posted: 9th Oct 2014 18:39
We are with a high school attempting to debug the carbonade game given by ISL. Whoever they are. So, our problem is with collisions, every time we collide with an orb in the fetch the fruit game for carbonade, the program crashes giving us error messages. The source code is attached. We want the program to work correctly by making the orbs disappear after collecting them. Our entire class has been working to no avail, our teacher cannot solve the problem either.
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 10th Oct 2014 08:03 Edited at: 10th Oct 2014 08:05
In general, it would be easier for people to help you if you post the text in the error message. However, I think I see the problem.

Starting on line 355, you have this:


So whenever the player collides with one of the fruit objects, you delete it. Say you collide with fruit 23. On the next frame, this code is going to attempt check if you collide with fruit 23 again with object collision(1,23). However, since object 23 was deleted this will cause an error.

An easy way to fix this would be to first check that the object still exists before checking the collision. The command for that is object exist(objectNumber).

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 10th Oct 2014 09:20
An easier method, replace line 359 with
rookie4407
11
Years of Service
User Offline
Joined: 9th Oct 2014
Location:
Posted: 10th Oct 2014 18:21
Thank you very Much! This fixed our problem!
rookie4407
11
Years of Service
User Offline
Joined: 9th Oct 2014
Location:
Posted: 10th Oct 2014 18:22
Thank you very Much! This fixed our problem!
rookie4407
11
Years of Service
User Offline
Joined: 9th Oct 2014
Location:
Posted: 10th Oct 2014 18:22
Thank you everyone! You helped us solve our problem!

Login to post a reply

Server time is: 2026-07-18 07:31:55
Your offset time is: 2026-07-18 07:31:55