Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualPatriarch K

Posted 21 March 2013 - 02:48 PM

At the moment I use booleans in the menu called level1 = false and so on. I wrap these booleans around the loop-function in every game file and it works. If I use the google debugging it doesn't cost too much. Is this a good method or is it awkward? It works fine at the moment at least.

 

Is there a way to run a function only once and then quit it afterwards in my main script without touching the game.js?

For example, if I do like this:

 

KEY PRESS ENTER{

switch(level)

case 1:

level1();

break;

 

case 2:

level2();

etc etc....

 

If I have it like that in the main function then it will of course run the level you pick. But when you've completed that level. Then that level has already started.

The same if i put the switch statements in the loop. Then it will run multiple times (or only one time if I use a boolean on it). But I still can't quit it.

 

Is this something I have to do in the level-files?


#2Patriarch K

Posted 21 March 2013 - 02:48 PM

At the moment I use booleans in the menu called level1 = false and so on. I wrap these booleans around the loop-function in every game file and it works. If I use the google debugging it doesn't cost too much. Is this a good method or is it awkward?

 

Is there a way to run a function only once and then quit it afterwards in my main script without touching the game.js?

For example, if I do like this:

 

KEY PRESS ENTER{

switch(level)

case 1:

level1();

break;

 

case 2:

level2();

etc etc....

 

If I have it like that in the main function then it will of course run the level you pick. But when you've completed that level. Then that level has already started.

The same if i put the switch statements in the loop. Then it will run multiple times (or only one time if I use a boolean on it). But I still can't quit it.

 

Is this something I have to do in the level-files?


#1Patriarch K

Posted 21 March 2013 - 01:39 PM

Hmm, is there a way to run a function only once and then quit it afterwards in my main script without touching the game.js?

For example, if I do like this:

 

KEY PRESS ENTER{

switch(level)

case 1:

level1();

break;

 

case 2:

level2();

etc etc....

 

If I have it like that in the main function then it will of course run the level you pick. But when you've completed that level. Then that level has already started.

The same if i put the switch statements in the loop. Then it will run multiple times (or only one time if I use a boolean on it). But I still can't quit it.

 

Is this something I have to do in the level-files?


PARTNERS