dieortin Posted May 12, 2014 Share Posted May 12, 2014 I'm building my own joystick class for my game, and my virtual joystick consists of two parts: the base, which doesn't move, and the mobile part of the top. I was usingthis.topPart.fixedToCamera = true;to fix the joystick position to the camera, as my game is a scroller and I want the joystick to stay in the same position. The problem is that if I set that property to true I can't change the sprite's position. And if I don't fix the sprite to the camera when the camera moves that part of the joystick will not stay in place. Is there any way for moving the sprite in relation to the camera position? If not, what alternative approach should I take? (I also tried adding the 'relative' position to the game.camera.view.x/y properties, but that showed to be quite slow) Link to comment Share on other sites More sharing options...
Alvin Posted May 12, 2014 Share Posted May 12, 2014 Hi, In order to move a sprite that is fixedToCamera, you need to use the cameraOffset property. You can then position the sprite wherever you want using sprite.cameraOffset.x and sprite.cameraOffset.y dieortin, megan and yousifucv 3 Link to comment Share on other sites More sharing options...
Recommended Posts