accelerometer and preserve scene issue
Sparkyidr
Member Posts: 2,033
hi.
I have a main game scene, with my player controlled by the accelerometer (using accelerate behaviours), and all works fine.
My problem is however, I have a pause button, which basically just changes to a new scene (pause screen) and preserves the current scene.
Once I hit the pause button gain, I revert back to the main scene, and as expected all is preserved as it should be.....BUT
The accelerometer is no longer controlling my player actor. It's just floats off into the bottom right of the screen until it hits my wall at the edge of the screen.
Any ideas?
Sparky.
I have a main game scene, with my player controlled by the accelerometer (using accelerate behaviours), and all works fine.
My problem is however, I have a pause button, which basically just changes to a new scene (pause screen) and preserves the current scene.
Once I hit the pause button gain, I revert back to the main scene, and as expected all is preserved as it should be.....BUT
The accelerometer is no longer controlling my player actor. It's just floats off into the bottom right of the screen until it hits my wall at the edge of the screen.
Any ideas?
Sparky.
Comments
Use two Change Attributes to kill the player's motion, like this:
Change Attribute: self.Motion.Linear.X To: 0
Change Attribute: self.Motion.Linear.Y To: 0
Otherwise the player will freak out when you return to the scene...
I have an attribute called "game paused".
When it's set to 0, I have all my accelerometer control behaviours.
When it's set to 1 I have the linear x and y set to 0.
When I hit the pause button, it sets gamepaused to 1, and changes the scene to the pause scene.
When I hit pause from the pause screen, it sets the gamepaused back to 0, and changes the scene back to the play screen.
When I remove that last step from the pause, I can se that my player is stopped, as expected. But when I have it in, it just does the ignoring of the controls as before.
I tried also setting in an extra step....so when I hit the pause to get back to the main screen, it sets "gamepaused" to 2..... then I have a rule that says :
when paused=2 sets paused to 0 after 1 second
just as a tester.
When I tried this, the player was stopped as expected for the 1 second....but as soon as paused is set back to 0, the player goes off on it's own.
seems really odd.