Jump to content

Body.halfHeight


xronn
 Share

Recommended Posts

Hi,

 

My game is top down and I can't walk down certain passages because my sprite body has inherited the full height of the sprite frame. 

 

http://puu.sh/6VGeY.png (See issue)


So i'm trying to half the size of the sprites body so the players head basically has no clip allowing me to walk down passages. 

 

This is what I came up with but doesn't seem to work.

//Drawing the hero        hero = this.add.sprite(295, 385, 'hero');        hero.body.collideWorldBounds = true;        hero.body.halfHeight = Math.floor(hero.currentFrame.sourceSizeH / 2);
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...