Jump to content

Keyboard Confusion


Circassia
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

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