Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualwarnexus

Posted 09 February 2013 - 08:21 PM

why are you calling run after you setIsRunning(true)?(now your in a loop inside the input function)

 

if that's not the problem, idk because you barely posted any real code.

 

what we need to see is:

 

Initialization code

--Main game loop(is this controlled by "isRunning", because if so, setting it to false should break the loop.)

---Where you check for input(is this inside your main loop, which is controlled by the "isRunning" flag?)

because my approach was to pause the game. The only way to do it is to break out of the gameLoop. If I unpause the game, I need to call the run method which execute the game loop to keep things drawing again. the run method needs to be called by the programmer. the key events are in the keyPressed method of the Game class since the Game class will be responsible for controlling the pause/unpause nature of the game.

 

Are you sure you saw my code? blink.png


#2warnexus

Posted 09 February 2013 - 08:15 PM

why are you calling run after you setIsRunning(true)?(now your in a loop inside the input function)

 

if that's not the problem, idk because you barely posted any real code.

 

what we need to see is:

 

Initialization code

--Main game loop(is this controlled by "isRunning", because if so, setting it to false should break the loop.)

---Where you check for input(is this inside your main loop, which is controlled by the "isRunning" flag?)

because my approach was to pause the game. The only way to do it is to break out of the gameLoop. If I unpause the game, I need to call the run method which execute the game loop to keep things drawing again. the key events are in the keyPressed method of the Game class since the Game class will be responsible for controlling the pause/unpause nature of the game.

 

Are you sure you saw my code? blink.png


#1warnexus

Posted 09 February 2013 - 08:12 PM

why are you calling run after you setIsRunning(true)?(now your in a loop inside the input function)

 

if that's not the problem, idk because you barely posted any real code.

 

what we need to see is:

 

Initialization code

--Main game loop(is this controlled by "isRunning", because if so, setting it to false should break the loop.)

---Where you check for input(is this inside your main loop, which is controlled by the "isRunning" flag?)

because my approach was to pause the game. The only way to do it is to break out of the gameLoop. If I unpause the game, I need to call the run method which execute the game loop to keep things drawing again


PARTNERS