Growler Posted February 7, 2018 Share Posted February 7, 2018 I'm following the MelonJS platformer tutorial again for 5.1 (used to be on 2.x). For some reason basic this.renderable.flipX(true); causes the sprite to rotate the width of itself (64px) on the x axis? Below, he's standing on the ledge. I tap left and he flips sprite, but is 65 pixels offset. How do I flip in place? Quote Link to comment Share on other sites More sharing options...
obiot Posted February 7, 2018 Share Posted February 7, 2018 Hi, yes indeed ! See here for both the explanation and the solution : https://github.com/melonjs/melonJS/issues/916 My bad as I ve been late in updating the tutorial accordingly ! Quote Link to comment Share on other sites More sharing options...
Growler Posted February 7, 2018 Author Share Posted February 7, 2018 This flips on the Y axis game.PlayerEntity = me.Entity.extend({ /** * constructor */ init:function (x, y, settings) { this._super(me.Entity, 'init', [x, y, settings]); this.body.setVelocity(3, 15); me.game.viewport.follow(this.pos, me.game.viewport.AXIS.BOTH); this.alwaysUpdate = true; this.renderable.addAnimation("walk", [0, 1, 2, 3, 4, 5, 6, 7]); this.renderable.addAnimation("stand", [0]); this.renderable.setCurrentAnimation("stand"); // set the renderable position to bottom center this.anchorPoint.set(0.5, 1.0); }, Result 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.