Circassia Posted August 2, 2015 Share Posted August 2, 2015 In my game i have 2 frame spritesheet. When user presses shift, if there is no collision, frame will show 2nd one, wait 10ms and show 1st one again and if user keeps pressing shift, if there is no collision, frame will show 2nd one till user releases the key. I couldn't make it. Your help is appreciated if(shoot.isDown) if(collide) { var dx = player.body.x - ball.x; var dy = player.body.y - ball.y; angleb = Math.atan2(dy, dx); ball.body.rotation = angleb + game.math.degToRad(-90); var angle = ball.body.rotation + (Math.PI / 2); ball.body.velocity.x = -400 * Math.cos(angle); ball.body.velocity.y = -400 * Math.sin(angle); shoot.isDown = false; } else{ } Link to comment Share on other sites More sharing options...
Recommended Posts