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 / Gosub Crashing

Author
Message
MPQC
15
Years of Service
User Offline
Joined: 7th Sep 2009
Location:
Posted: 12th Sep 2009 22:21
Well. I was following the guide for a simple 2D shooter, and I've been having issues with the gosub command. Lets take a snipit:



Now, whenever I do anything like this, it seems to just crash my game on startup. I've tried plugging in multitudes of different commands into the sub, though nothing works. (Leaving it blank also crashes.)

I'm currently running Vista 32bit, and I do have admin permission & compatibility for Windows XP on both the editor, and the exe. (Using Dark Basic Pro.)

Any help? :/
Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 12th Sep 2009 23:14
The subroutine that you are going to needs to be at the end of your program, after an End command designates the end of the program. In your code, the computer is going to shoot, executing the code, returning then carrying straight on through the sub-routine a second time and hitting the return again...only the second time it doesn't know where to return to and crashes.

"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library

First you Dream, then you ... - Neil Gaiman, 2001
MPQC
15
Years of Service
User Offline
Joined: 7th Sep 2009
Location:
Posted: 12th Sep 2009 23:19
Ah, thanks very much. Got it working.

Login to post a reply

Server time is: 2024-11-24 01:32:18
Your offset time is: 2024-11-24 01:32:18