Jump to content

Moving rectangles and other non-sprites


ForgeableSum
 Share

Recommended Posts

Is there a way to move geometric objects, like a rectangle? I try enabling a physics and moving with moveToXY and I get an error when I try to move it. 

 

Uncaught TypeError: Cannot read property 'velocity' of undefined

 

What I am trying to do is to display a health bar above a sprite. When the sprite moves, I want the healthbar to move a long with this. I'm not sure the best way to go about doing this though. I don't even know if using a rectangle is the best approach. Maybe I should use a second sprite for the health bar? Would that be sort of inefficient?

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.

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

  • Recently Browsing   0 members

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