Jump to content

Moving a camera-fixed sprite


dieortin
 Share

Recommended Posts

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 using

this.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

 Share

  • Recently Browsing   0 members

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