dieortin

Moving a camera-fixed sprite

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)

Share this post


Link to post
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.

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

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.