Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. ///scr_move_state
  2. scr_get_input();
  3.  
  4. // Get the axis
  5. var xaxis = (right_key - left_key);
  6. var yaxis = (down_key - up_key);
  7.  
  8. // Get Direction
  9. var dir = point_direction (0, 0, xaxis, yaxis);
  10.  
  11. //Get the Legnth
  12. if (xaxis == 0 and yaxis = 0) {
  13. len = 0;
  14. } else {
  15. len = spd;
  16. }
  17.  
  18. // Get the hspd and vspd
  19. hspd = lengthdir_x (len, dir);
  20. vspd = lengthdir_y(len,dir);
  21.  
  22. // Move
  23. phy_position_x += hspd;
  24. phy_position_y += vspd;
  25.  
  26. // Vertical Sprites
  27. image_speed = sign(len)*.2;
  28. if (len == 0) image_index = 0;
  29.  
  30. if (vspd > 0) {
  31. sprite_index = spr_player_down;
  32. } else if (vspd < 0) {
  33. sprite_index = spr_player_up;
  34.  
  35. // Horizontal Sprites
  36. if (hspd > 0) {
  37. sprite_index = spr_player_right;
  38. } else if (hspd < 0) {
  39. sprite_index = spr_player_up;
  40. } <--- ERROR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement