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 / Cant shoot

Author
Message
sonydude 46
17
Years of Service
User Offline
Joined: 31st Dec 2006
Location: I dont even know!
Posted: 8th Mar 2010 18:36
The "n" will go to 150, then it will stick there. Pushing the "O" key will set n to 0 and even then, nothing works.

Help?




"If this place isn't hell its in the same zip code"
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 8th Mar 2010 19:10
Alright I may have caught it. Preliminary question: when it sticks at 150, does anything else happen or does everything lock up?

Analysis:


Note that the NEXT n command comes AFTER you have reset N to 51. So what this will do is the FOR-NEXT loop will never end, because on the last run, n goes from 150 (the last number) to 51. Once it hits NEXT, it will check to see if it has exceeded the bounds of the loop, but since it has been reset, it continues on with the loop.

A suggestion for the fix would be to remove the ELSE command.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 8th Mar 2010 19:45
1. You're using the variable n multiple times for different things.

2. The spacekey() should only create bullets and you need a separate routine to handle the bullets.


I changed your usage of "n" a bit. When creating objects in a for..next loop, once you found an available pointer you must exit the loop!



The counter for bullets are changed from "n" to "Bullets".



A subroutine was added to handle the Bullets. It's still missing a delete bullet when it gets too far or collision.




Hope this helps.

Login to post a reply

Server time is: 2024-03-28 22:26:51
Your offset time is: 2024-03-28 22:26:51