bymafmaf Posted December 15, 2015 Share Posted December 15, 2015 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 More sharing options...
Zendrael Posted December 15, 2015 Share Posted December 15, 2015 Hi! If you are using Arcade physics you could do something like://width, height, offsetX, offsetYYOUR_OBJECT.body.setSize(32, 32, 0, 16);and thus increase the interaction area of the object. Link to comment Share on other sites More sharing options...
bymafmaf Posted December 15, 2015 Author Share Posted December 15, 2015 Thanks but I don't use any physics. Link to comment Share on other sites More sharing options...
bymafmaf Posted December 15, 2015 Author Share Posted December 15, 2015 I looked at pixi code as it is stated in Phaser docs that hitarea is a property of PIXI.DisplayObject but at http://pixijs.github.io/docs/PIXI.DisplayObject.html there isn't such a thing. Link to comment Share on other sites More sharing options...
Recommended Posts