Friday 15 August 2014

javascript - Collide function only taking x and x+width? -


I think I will have a collision, in general if you hit a platform, I find it very stubborn However, if the platform is too small it is not equal to x or x + width and y, so the player drops down faster how can I solve it?

This is my collision code:

 for  (var i = 0; i  platforms [i] .x and player.x <(platform [i]. X + platform [i] wide.) {If (Player.y + (player .Hy) & gt; ; Platform [i]. And end player.A.Lt; platforms [i]. I + platform [ii] .text {Player.jumping = false; Player.playerColour = "orange"; Player.velY = 0; Player.velX = 0; }} And {gravity = 0.3; }}    

  player wide = fourth player moves; // Assign your value to here (var i = 0; i & lt; platform; length; i ++) {if (! (Player.x  (platform [i] .x + platform [i] wide)) (if (player! Player and lefgh; (platform [i] .x-playerHeight) Player. A & Gt; platform ([i] .i + platform [ii] .hite))) {Player.jumping = false; Player.playerColour = "orange"; Player.velY = 0; Player.velX = 0;}} and { Gravity = 0.3;}}   

I know if this works otherwise, then do some more effort Defense does if we do not remember a case. And yes, congratulations on the way, you are building a very good concept.

No comments:

Post a Comment