Advertisement
flashjaysan

GMS2 Limiter la position d'un objet v1

May 17th, 2020
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if keyboard_check(vk_right)
  2. {
  3.     x += 5;
  4. }
  5. if keyboard_check(vk_left)
  6. {
  7.     x -= 5;
  8. }
  9. if keyboard_check(vk_down)
  10. {
  11.     y += 5;
  12. }
  13. if keyboard_check(vk_up)
  14. {
  15.     y -= 5;
  16. }
  17. if x < 0
  18. {
  19.     x = 0;
  20. }
  21. if x > room_width - 1
  22. {
  23.     x = room_width - 1;
  24. }
  25. if y < 0
  26. {
  27.     y = 0;
  28. }
  29. if y > room_height - 1
  30. {
  31.     y = room_height - 1;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement