Ellison Leão Posted December 13, 2016 Share Posted December 13, 2016 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! Quote Link to comment Share on other sites More sharing options...
Parasyte Posted December 13, 2016 Share Posted December 13, 2016 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: 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. 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! Quote Link to comment Share on other sites More sharing options...
obiot Posted December 14, 2016 Share Posted December 14, 2016 i put together a fiddle that showcase how to use the new rotate function : https://jsfiddle.net/obiot/u827sev1/19/ Quote Link to comment Share on other sites More sharing options...
Ellison Leão Posted December 14, 2016 Author Share Posted December 14, 2016 Thanks for the help guys. The game is now migrated to the latest version. Quote Link to comment Share on other sites More sharing options...
obiot Posted December 14, 2016 Share Posted December 14, 2016 Awesome ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.