Jump to content

Can't play animations

Recommended Posts

Hello, today my problem looks so stupid, but I can't find a way to solve it. I have a couple of animations that I add using:

this.player.animations.add('idle', Phaser.Animation.generateFrameNames('idle_',1,4), 6, true);
        this.player.animations.add('ataque', Phaser.Animation.generateFrameNames('ataque_',1,2), 10, true);
        this.player.animations.add('daño', Phaser.Animation.generateFrameNames('daño_',1,2), 5, true);
        this.player.animations.add('camina', Phaser.Animation.generateFrameNames('camina_',1,5), 10, true);
        this.player.animations.add('muerte', Phaser.Animation.generateFrameNames('muerte_',1,10), 5, true);

Everything's perfect, using this.animations,play('string') I can play it as well, but here's my problem:

To make my player attack I use Key.justDown, because I want it to attack once per pressing, but if I do:



in this case this.Q = game.input.keyboard.addKey(Phaser.Keyboard.Q); and is the same I use to make attacks

if I use the propertie isDown it plays it, but is useless for me becasue the attack have finished and the animation still looping, even if I set to false the 4th parameter of animations.add.

Link to post
Share on other sites

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