Jump to content

Controls in game outside the camera


Recommended Posts

I'm have a camera effect in my game that shakes the camera when you shoot an enemy. However, the game has to have some on screen buttons for tablet devices and I don't want these to shake. Ive currently got these in a group. Is it possible to have these outside of the camera so they aren't affected by the shake?

Link to comment
Share on other sites

Add your controls to the stage instead of the world, like "this.game.stage.addChild(controlSprite);". The camera view works by offsetting the position of the world so your controls should be safe there.

One consequence of that is you'll have to manage removing them on state transition since, by default, the StateManager clears the world on state transition.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...