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

 Share

  • Recently Browsing   0 members

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