Guest User

Untitled

a guest
Sep 10th, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. ///shyguyStep(speed)
  2. //General enemy step event code
  3.  
  4. //Allows horizontal movement
  5. if dead == false && domove == true //If we are not dead, and if we can move
  6. x += fric;
  7.  
  8. //Checks if we are not on the ground
  9. if (!place_meeting(x, y+vspeed+1, par_platform) && !place_meeting(x, y+vspeed+1, par_platform)
  10. && !place_meeting(x, bbox_bottom+vspeed+1, par_slope)) or vspeed < 0 //If neither a solid, a topsolid or a slope is below us or we are moving up
  11. ground = false; //We are not on the ground
  12. //For the checks if we ARE on the ground, see enemyCollision()
  13.  
  14. //Gravity
  15. if ground == false //If we are not on the ground
  16. gravity = _gravity; //Let the gravity work
  17. else if dead == false //Else, if we are on the ground and we are not dead
  18. gravity = 0; //Stop the gravity
  19.  
  20. //If we are on the edges of the room, turn around
  21. if x < 3 //Left edge
  22. {
  23. x = 3;
  24. fric = abs(fric); //We are moving right
  25. }
  26. else if x > room_width-3 //Right edge
  27. {
  28. x = room_width-3;
  29. fric = abs(fric) * -1; //We are moving left
  30. }
  31.  
  32. //If we are too high, let us stop
  33. if y < -10 //Top edge
  34. {
  35. y = -10;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment