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 / Locks up when trying to initiate level.

Author
Message
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 3rd Oct 2004 03:54
Hi!

I have the base engine done on my game, but I want to expand and create multiple levels, I planned this out extensively on paper, and the best way to do this from my knowledge is to put everything that the level is supposed to do, into gosub statements that can be loaded when a condition is met.
So I took my code and moved everything that the first level does into a subroutine at the end of my code outside the loop, this inculded objects, collision, timers, bullets, and all that good stuff. The problem is that the game now locks up after pressing the space key (the key that is supposed to initiate the subroutine). Here is my code, I am sure I did something very wrong and very stupid, but this is a learning experience! So please inspect my code as you wish, and make any suggestions as necessary, oh yeah the code.......



Thank you for your time!

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Dom
20
Years of Service
User Offline
Joined: 31st May 2004
Location:
Posted: 3rd Oct 2004 04:00
Hi,

Im no expert and this probably wont help you much but its a suggestion. When I do GOSUBS (Which I do a lot) I put them In their own separate loop outside the main loop. Eg:

`The main Loop to start the GOSUB
Do
If spacekey()=1 then Gosub Hello
Loop

`The secondary loop woth th Sub-Routine in it
Do
Hello:
Print "Hello!"
Wait 5000
End
Loop


Hope I helped a bit!

I am currently working on : A Medievil style game
By the way I'm 13 years old!!
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 3rd Oct 2004 04:03
I would do that, but sense I have create object commands within that subroutine, won't it go on a create object field day every loop.

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 3rd Oct 2004 07:27
Ok, I moved all the create object commands out of the subroutine, and it no longer locks up, but I must hold down the space bar to play the level, this shouldn't be the case, I want to simply press the space bar and have the subroutine start running, and stop running only when a condition is met. Here is my code......



Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 4th Oct 2004 02:59
If someone could help me out with this, It would be much appreciated.

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Dot Merix
21
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 4th Oct 2004 03:57
Sure... i think i know exactly what the problem is.. you need a switch.



In your code you should have a global called switch



Try that out and see if it works.



WindowsXP Home(Service pack 2), Athlon XP 2400+(2.1Ghz), 1GIG Ram, Ati Radeon 9800Pro 128MB.
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 4th Oct 2004 13:04
I tried that, and you still need to hold down the space bar to run the subroutine, It would be nice If I was trying to program a pause button but unfortunatly that is not my entention. Any other suggestions?

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Dot Merix
21
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 4th Oct 2004 13:34 Edited at: 4th Oct 2004 13:36
You replaced
with


Well, you've got me.. dont know why it doesnt work.. will take another look tomorrow i guess.



WindowsXP Home(Service pack 2), Athlon XP 2400+(2.1Ghz), 1GIG Ram, Ati Radeon 9800Pro 128MB.
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 5th Oct 2004 07:12
Here is my code if you want to see it again....



And here is the specific code in question....



Still can't get it working

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Dot Merix
21
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 5th Oct 2004 08:07 Edited at: 5th Oct 2004 08:08
make sure before the loop you set switch to 0..

ie..


Not sure if the above code works..

Could also try




WindowsXP Home(Service pack 2), Athlon XP 2400+(2.1Ghz), 1GIG Ram, Ati Radeon 9800Pro 128MB.
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 5th Oct 2004 10:02
there was nothing wrong with your code you just did not add sync in the level1 loop



You can do it if you try
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 5th Oct 2004 10:11
Hey, thanks X_MEN! It's always the simplest things I screw up on , it works great now, maybe now I can start adding more levels!

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 5th Oct 2004 10:51
Ok I need some more help, There are a few things that are really annoying me. The biggest problem, is that I can't seem to get my makeshift sliding collision working again, object 6 to 15 collide and move when they hit objects 204 to 206, but if the second wave of enemys hit them, they do nothing! How can I adapt the code so that it will move the second waves as well? Two other annoyances are the fact that the player can move the objects around and kill all the enemys after the timer runs out, this should not be the case, once the timer runs out, the objects should be stuck in place, or collision should be turned off while objects move. Thos two problems are the most seriouse and I can't think of a solution to either, so I need some help.

Code is below.




Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.

Login to post a reply

Server time is: 2025-05-24 18:58:15
Your offset time is: 2025-05-24 18:58:15