RestingCoder Posted February 5, 2014 Share Posted February 5, 2014 I have been using the dev branch for a couple weeks, and everything was going well. Now, I have switched to the release version of 1.1.4, and made what I believe are all the changes needed to make things work. However, for something as simple as causing my player sprite to jump, it does not work. This code snippet is for my player class, extended from sprite:console.log(this.body.onFloor()); if (this.jumpButton.isDown && this.body.onFloor() && this.game.time.now > this.jumpTimer) { console.log('beep'); this.body.velocity.y = -720; this.jumpTimer = this.game.time.now + 250; }'beep' is triggered, but the sprite does not move. At all. I have also found that this code only works if I am already moving horizontallyif (this.arrowKeys.up.isDown) { this.body.velocity.y = -400;}You can see an example of this here: http://play.reminiscencegame.com/example2/ Link to comment Share on other sites More sharing options...
rich Posted February 5, 2014 Share Posted February 5, 2014 Does the body have a bounce value set? If so try giving it a minVelocity (and maybe linearDamping too). Like I had to do in the Star Struck demo. Link to comment Share on other sites More sharing options...
RestingCoder Posted February 6, 2014 Author Share Posted February 6, 2014 minVelocity was already set as a test, and I have tried adding various values for linearDamping. Interestingly enough, if I set the bounce at all (no matter the value), the player sprite will stop moving entirely if it touches any walls. I am also seeing an issue where the sprite is not dropping like it should. To reproduce this, use the up arrow in the example I linked previously, and land on any of the platforms that aren't what you would consider the floor. Now, move left or right, off the platform. You will basically be stuck in the air until you move along the y axis again. I really have no idea what is going on here, but all of this works perfectly with what was in the dev branch up until a day or two ago. Link to comment Share on other sites More sharing options...
rich Posted February 6, 2014 Share Posted February 6, 2014 No worries I'll look into it. Link to comment Share on other sites More sharing options...
jcs Posted February 6, 2014 Share Posted February 6, 2014 I had to set 'body.blocked.down' and 'body.touching.down' to 'false' after setting the velocity in order for my old jump code to work... Link to comment Share on other sites More sharing options...
RestingCoder Posted February 6, 2014 Author Share Posted February 6, 2014 Thanks, Rich.jcs, I'll try that next time I am at the computer. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts