Jump to content

need help from someone in animation


Iblotn
 Share

Recommended Posts

hello guys i'm newbie in phaser framework 

 

so i have questiion to finish a game 

my game is the same with ninja fruit 

but i have a problem with the animation when the players cut the object in the game for example fruit 

i do it when the player touch the object it kill 

but me i like to add some animation like those in ninja fruit when you touch the fruit 

he show knife but the fruit and then divided them into parts of the place of the cut (lump it)

me i create the game the some of this 

http://examples.phaser.io/_site/view_full.html?d=particles&f=collision.js&t=collision

and i add when the player touch any fruit the fruit will kill and be invisible 

but i like to add animation like ninja fruit i Explained it in the top 

 

so help me , and thanks

 

Link to comment
Share on other sites

This isn't an easy question to answer, since it's not a simple mechanic. I think a basic way to approach this would be to have at least three sprites - the full fruit, and then two halves of the fruit. When the fruit is killed, it instantly spawns the two halves and sends them in random and somewhat opposed directions. Don't try to think of it as splitting a sprite in half, as this is generally not how games work.

Link to comment
Share on other sites

Yes, as lewster32 said, have a two halves of the fruit sprite, and for animation rotate the halves by tweening their angle property.

game.add.tween(fruitFirstHalf).to({angle:180}, 500);game.add.tween(fruitSecondHalf).to({angle: -180}, 500);

Also tweak the x,y values too for a more realistic effect as you like.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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