Jump to content

Upgrading clumsy-bird to melon 4


Ellison Leão
 Share

Recommended Posts

Hey guys, long time no see.

I am trying to upgrade the clumsy bird game to the latest melonjs release, but i am getting several issues here. I was able to solve most of them, but one in particular i would need help from you guys.

The problem is that the old code was using the now deprecated renderable.angle , which grabbed the current sprite rotation angle in order to update its rotation.  Now that property is gone, how can we get the current sprite rotation angle information? I've tried to setup a local var with the current angle information, and tried to get the current rotation and make the changes using the new currentTransform  matrix. 

Is there an easy way i can achive this? the current logic is here https://github.com/ellisonleao/clumsy-bird/blob/master/js/entities/entities.js#L39-L54

 

Thanks in advance!

Link to comment
Share on other sites

Hi Ellison! Glad to see your projects keeping up with melonJS release cycles.

The rotate method on the transformation matrix can only apply rotation deltas; it's not able to set absolute angles. I see two solutions off the top of my head:

  1. You have a currentAngle property which you could continue using. When it's time to apply the angle to the matrix, just reset the matrix with `this.renderable.currentTransform.identity()` and then use the rotate method with the value of currentAngle.
  2. Create a Tween on the currentAngle property, and in the Tween's update callback, rotate the renderable by the update delta (it's passed to the callback).
    • Don't forget to reset the matrix with identity() and rotate() when the flap key is pressed!

I hope one of these ideas works for you. Just let us know!

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

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

Loading...
 Share

  • Recently Browsing   0 members

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