Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /// scr_move_state
  2. scr_get_input();
  3.  
  4. /// Checking for dash
  5. if (dash_key) {
  6. state = scr_dash_state;
  7. alarm[0] = room_speed / 7;
  8. }
  9.  
  10. /// Checking for attack
  11. if (attack_key) {
  12. image_index = 0;
  13. state = scr_attack_state;
  14. }
  15.  
  16. /// Get direction
  17. dir = point_direction(0, 0, xaxis, yaxis);
  18.  
  19. /// Get the length
  20. if (xaxis == 0 and yaxis == 0) {
  21. len = 0;
  22. } else {
  23. len = spd;
  24. }
  25.  
  26. /// Get the hspd and vspd
  27. hspd = lengthdir_x(len, dir);
  28. vspd = lengthdir_y(len, dir);
  29.  
  30. /// Move
  31. phy_position_x += hspd;
  32. phy_position_y += vspd;
  33.  
  34. /// Control the sprite
  35. image_speed = .2;
  36. if (len == 0) image_index = 0;
  37.  
  38. /// Vertical sprites
  39. if (vspd > 0) {
  40. sprite_index = spr_player_down;
  41. } else if (vspd < 0) {
  42. sprite_index = spr_player_up;
  43. }
  44.  
  45. /// Horizontal sprites
  46. if (hspd > 0) {
  47. sprite_index = spr_player_right;
  48. } else if (hspd < 0) {
  49. sprite_index = spr_player_left;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement