Jump to content

How to set hitArea properly guys help me?


Recommended Posts

Since I've started to develop my game I couldn't fix it. I need a a rectangle that is wider than the object for dragging. Because in mobile screens it is hard to touch to exactly sprite.


I want to create a rectangle and assign to a sprite's hitArea property. Just that simple. But it doesn't work.

var thirdOfFooterBoard = new Phaser.Rectangle(place * game.world.width/3, game.world.centerY + 55*5,(game.world.width/3)-5, game.world.height- (game.world.centerY + 55*5) );    this.hitArea = thirdOfFooterBoard;

Only when I do like this, it works:

this.hitArea = new Phaser.Rectangle(0,0, 20, 20);

BUT I have three sprite next to each other. I set it like this and after some while I can't drag one of them anymore. I thought maybe two hitareas conflict and when one is touched the other gets disactivated but I'm setting it in a way that they can't touch each other but still same.


I just want to create a rectangle and assign it to sprite as hitarea.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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