Jump to content

Problems with animation


Recommended Posts

Hello, it's me again with a new disturbing ...
I have an enemy that I declare equal to this example ...


But I want to give you animation so that you do not look quiet all the time the object that follows you, any ideas ???


Link to comment
Share on other sites

Add those two lines below the line that creates the "spider":

       spider.animations.add("ani1", [1, 2, 3, 4], 10, true);

When running the exmaple, the gameboys will now switch color

Edit of the linked example: http://codepen.io/anon/pen/OmojRb?editors=0010

Now switch the different color pictures of the gameboys with spider animation frames. Done :)

Here is the example you can look at: http://phaser.io/examples/v2/animation/sprite-sheet

Notice that the example doesn't specify frames, but the spider code above does.

You need to specify frames if you have more than one animation in the sprite sheet.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...