montane Posted April 21, 2016 Share Posted April 21, 2016 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 More sharing options...
olemoritz Posted April 21, 2016 Share Posted April 21, 2016 As far as I understand it, this is what the fixedToCamera attribute is for. Maybe you can just set it to true for your "controls" group? VitaZheltyakov 1 Link to comment Share on other sites More sharing options...
montane Posted April 21, 2016 Author Share Posted April 21, 2016 Hi, thanks for the reply! I appreciate it. If I set the controls group to have fixed to camera, then they are fixed to the position of the camera. However, the camera.shake() method shakes the camera which includes my controls. Link to comment Share on other sites More sharing options...
drhayes Posted April 21, 2016 Share Posted April 21, 2016 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 More sharing options...
olemoritz Posted April 21, 2016 Share Posted April 21, 2016 Ah, so I had it completely backwards. Link to comment Share on other sites More sharing options...
montane Posted April 22, 2016 Author Share Posted April 22, 2016 @olemoritz I tried it first but the use of fixedToCamera is voided by shaking the camera Perhaps the shake effect would be good to have a option to shake either the world or the camera as camera shake (observer shaking) may be desired or world shake maybe desired (earthquake etc). Link to comment Share on other sites More sharing options...
Recommended Posts