I've just tried using the Game States in the "Lite" Version (using 'state.setGameStart ( )', and it appears that the "onEnter" state gets executed almost 200 times?
This is the output from my run where I've used an 'lprint' for each function (I've cut a lot of the "onEnter" out, but there was a total of 198 of them):
- Code: Select all
onInit
loadLayouts
loadTiles
loadHighScores
onKeyDown
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
...
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
onExit_GameStart
onEnter
onStop
Thanks in advance
Shando
PS: I have run this a few times and get 198 'onEnter_GameStart' each time.
PPS: Just re-run with an 'lprint' for each line of code in the 'onEnter' and none of the lprints are printed to the console.
PPPS: Just tried with 'sky.setGameState ( 3 )', which appears to work better, but it only prints the 1st 'lprint' (which is followed by 'camera.setPosition ( cam, 0, 25, -20 )' - does this mean that States cannot access variables (the camera was set up in the Scene Editor)?