fatboyarming Posted March 29, 2018 Share Posted March 29, 2018 like this example http://jsfiddle.net/lewster32/u3p5n/ When using game.input.activePointer.isDown Click anywhere on the screen to trigger an event function update() { if (game.input.activePointer.isDown) { this.sprite.velocity.y += -50; } } but Is it possible to set a specific area to use for game.input.activePointer.isDown? Like the follow screen, on or two figer tought is possible?? Thanks Link to comment Share on other sites More sharing options...
in mono Posted March 29, 2018 Share Posted March 29, 2018 Just check the pointer's x. function update() { if (game.input.activePointer.isDown && (game.input.activePointer.x < 200 || game.input.activePointer.x > 400)) { this.sprite.velocity.y += -50; } } Reference: https://photonstorm.github.io/phaser-ce/Phaser.Pointer.html Link to comment Share on other sites More sharing options...
onlycape Posted March 29, 2018 Share Posted March 29, 2018 Hi @fatboyarming , You can use a rectangle to define the zones, and in the onDown event check the position of the pointer. I have done it in the create function. This is the code (you can test it here): function create() { //Add a rectangle. In this case it represents the left half of the screen (screen size is 800x600). var zoneLeft = new Phaser.Rectangle(0, 0, 400, 600); //And for the other half... var zoneRight = new Phaser.Rectangle(400, 0, 400, 600); //Add callback to onDown event game.input.onDown.add(function(){ //If activePointer position is on left rectangle ... if(Phaser.Rectangle.containsPoint(zoneLeft, game.input.activePointer.position)){ console.log('left zone clicked'); } //If activePointer position is on Right rectangle ... else if (Phaser.Rectangle.containsPoint(zoneRight, game.input.activePointer.position)){ console.log('right zone clicked'); } },this); } I haven't used the multitouch so I can't tell you about that, but I thik you have to use the array input.pointers[]. Regards. Link to comment Share on other sites More sharing options...
Recommended Posts