Wednesday, October 9, 2013

Building custom controls in Stencyl - Part 3

I expected to be much more complicated but I achieved pausing functionality with just several clicks :)

Check out this page http://www.stencyl.com/help/view/pausing/

Go to physics tab on the SpaceRanger actor. I set the main character to be independent of gravity, and cannot be rotated. In the advanced tab I just unset can be touched ability for iOS. I leave can be pause abilty on. Here are images of events I set for Scene1:




 Same as in the wiki page above. Save your game and test it. Now when you press P button the space ranger will be freezed and the screen will get dimmed.

You can also play with the focus event i.e pause the game if the focus is lost and unpause the game if the focus is restored. Gaining/loosing focus means if you press on the flash player canvas or if you press away from the canwas. I added two more focus events on Scene1.



You can check this with you mouse when you click on the taskbar and then again on the flash canvas

No comments:

Post a Comment