Jump to content

Click/touch not working on mobile


Irn3rd
 Share

Recommended Posts

var sprite = new game.Sprite('present.png', this.positionX, this.positionY, {		});		sprite.interactive = true;		sprite.mousedown = function(event)		{			console.log("Mousedown X:" + event.global.x + ", Y:"+event.global.y);			 // Android double tap fix			if (game.device.mobile && !event.originalEvent.changedTouches) return;						game.scene.addScore();			this.remove();		}		game.scene.addTween(			sprite.position,			{				y:game.system.height			}, 2000,			{				easing:'Quadratic.In',				onComplete: function(){					if(sprite.__hit === true)					{						sprite.remove();					}else{						game.scene.takeLife();						sprite.remove();					}				}			}		).start();				sprite.addTo(game.scene.stage);

I'm adding a new sprite with the code sample above. it works on desktop fine, but when i move to mobile to test the touch/click event isn't captured at all.

 

Any idea why this might be happening? 

 

Many thanks

Link to comment
Share on other sites

  • 3 months later...

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...