Jump to content

Touching screen "reset" animation with mobile

Recommended Posts

Hi all,

I modify the invader exemple here, and I wanted to make it mobile friendly.

I add "button" :

	    boutonGauche = game.add.sprite(0, game.world.height - 60, 'bouton-gauche');
	    boutonDroite = game.add.sprite(game.world.width - 64, game.world.height - 60, 'bouton-droit');
	    boutonFeu = game.add.sprite(game.world.centerX - 32, game.world.height - 60, 'bouton-feu');

And bind it :

	    boutonGauche.events.onInputDown.add(bougerGauche, this);
	    boutonDroite.events.onInputDown.add(bougerDroite, this);
	    boutonFeu.events.onInputDown.add(fireBullet, this);
function bougerGauche(e) {
	return bouger('gauche');

function bougerDroite(e) {
	return bouger('droite');

function bouger(mode) {
	if (mode == 'droite') {
		player.x = player.x + 5;
	} else {
		player.x = player.x - 5;
	return false;

But nothing append, the animation restart each time I press on screen.

Can you help me please ?


Link to post
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.

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.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...