Jump to content

Tween sprite with multiple text


Balamurugan
 Share

Recommended Posts

I want to show winning animation in my game. Like this Image. I have 4 text like star- 3500 , best - 20548 , coins - 100 and diamonds - 35. i don't know how to handle this situation. Please give any reference how to handle this type of tween. And also how to merge the 4 text into sprite and make tween. please tell what are the possible ways there. Please share your experience.

Free-Game-UI-696x464.jpg.db3e0e0f952ca7918a88679fe1f1fd62.jpg

Link to comment
Share on other sites

You will never handle this with single game object. You have to build your own complex game object with other game objects.

Split it into atomic objects that are present in Phaser. Then build up. For example, Phaser has Sprite and BitmapText - these are atomic for you. Create new class extending Phaser Container, put Sprite and BitmapText into it and you have new game object element "Sprite with text" ... so you can, for example, make: "* 3500"
Then create buttons and any other elements you need and finally create WinDialog (again extending Phaser Container) and compose it from your basic elements.

You can then tween whole dialog (like pop) or tween any individual elements.

BTW, dialog like this is lot of work. Do not expect single function or game object to do all the work for you...On the other hand, if you make your elements good, then you can reuse it for other dialogs (and even outside of dialogs) in game - like "Sprite with text" in game HUD

 

Link to comment
Share on other sites

16 hours ago, Tom Atom said:

You will never handle this with single game object. You have to build your own complex game object with other game objects.

Split it into atomic objects that are present in Phaser. Then build up. For example, Phaser has Sprite and BitmapText - these are atomic for you. Create new class extending Phaser Container, put Sprite and BitmapText into it and you have new game object element "Sprite with text" ... so you can, for example, make: "* 3500"
Then create buttons and any other elements you need and finally create WinDialog (again extending Phaser Container) and compose it from your basic elements.

You can then tween whole dialog (like pop) or tween any individual elements. 

BTW, dialog like this is lot of work. Do not expect single function or game object to do all the work for you...On the other hand, if you make your elements good, then you can reuse it for other dialogs (and even outside of dialogs) in game - like "Sprite with text" in game HUD 

 

Please send any reference link or any code sample. Thank you so much for your response. And also i check your phaser timer based game pirates the match. In this game if i minimize the window, timer is stopped. I also try this scenario  timer is stopped when i minimize window. Its great drawback in browser. i dont know this pblm is in browser or phaser. Any Idea, about window minimize game is paused. how to prevent game pause when minimize browser window.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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