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 / Collision Problems

Author
Message
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 18th May 2010 19:27
I am trying to get it so that when the beach ball hits one of the platforms, everything gets deleted, except for the floor platform and the character. This is what I have:



The thing is though, it's not working! Any ideas why?

This is the part in my code that is supposed to do that:



Why do they turn against me? Especially when i need them the most?
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 18th May 2010 22:54 Edited at: 18th May 2010 23:01
Well, from what I can see you are deleting your objects. Then going to Level 2. Which promptly returns you back into the main loop as if nothing happened. There you are stuck in a loop of death so to speak.
I can't be sure if that's the problem as I have only looked at the code on here. If that is the problem, and I am pretty sure it is, instead of sending it to level 2 as you do send it to a resetup section, where you reset up your variables and graphics (if needed). From there you get it to check what level you are and send you to it. Or better still dependent on the game just change relevant variables and reuse the same main code, rather than copying huge chunks for each level and adjusting, as undoubtedly with this approach you will have to do.
Edit - For instance, if you were doing pac-man, you would hardly want to use new code for each level. You would end the level, reset your player, ghosts and items, positions and states.Then change the maze if that is a feature, then rerun the same basic control code. Ad infintum( or amount of levels ).
However you could just copy all the code, call it level 2, alter it accordingly, ad infintum. But you can see it would rapidly increase the size of the program needlessly.
Anyway I am finished now, hope I helped with my ravings.

http://s6.bitefight.org/c.php?uid=103081
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 19th May 2010 00:24
it works if i hit the side of the platform though.

Why do they turn against me? Especially when i need them the most?
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 20th May 2010 21:21
Putting it simply, you are deleting the objects then returning to the main loop without creating new ones.

http://s6.bitefight.org/c.php?uid=103081
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 23rd May 2010 17:06
so instead of having each sub return to the main loop, i should have a main loop for each level?

Why do they turn against me? Especially when i need them the most?

Login to post a reply

Server time is: 2026-07-25 14:18:29
Your offset time is: 2026-07-25 14:18:29