Advertisement
Guest User

Untitled

a guest
May 18th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Player is STILL
  2. if (global.ctrl_left = 0 && global.ctrl_right = 0 && global.ctrl_up = 0 && global.ctrl_down = 0)
  3.     {
  4.     hspeed = 0;
  5.     vspeed = 0;
  6.     sprite_index = sp_PlayerMov;
  7.     image_speed = 0;
  8.     global.CharAnim = 'still';
  9.     if (global.CharDirect = 'right')
  10.         {
  11.         image_index = 0;
  12.         }
  13.     if (global.CharDirect = 'left')
  14.         {
  15.         image_index = 5;
  16.         }
  17.     if (global.CharDirect = 'up')
  18.         {
  19.         image_index = 10;
  20.         }
  21.     if (global.CharDirect = 'down')
  22.         {
  23.         image_index = 15;
  24.         }
  25.     }
  26.      
  27. //RIGHT Walking Animation
  28. if (global.ctrl_left = 0 && global.ctrl_right = 1)
  29.     {
  30.     if (global.CharAnim = 'still')
  31.         {
  32.         sprite_index = sp_PlayerMov;
  33.         image_index = 1;
  34.         image_speed = 0.15;
  35.         global.CharAnim = 'moving';
  36.         global.CharDirect = 'right';
  37.         }
  38.     if (global.CharAnim = 'moving' && global.CharDirect != 'right')
  39.         {
  40.         sprite_index = sp_PlayerMov;
  41.         image_index = 1;
  42.         image_speed = 0.15;
  43.         global.CharAnim = 'moving';
  44.         global.CharDirect = 'right';
  45.         }
  46.     if (image_index > 4)
  47.         {
  48.         image_index = 1;
  49.         }
  50.     }
  51.  
  52. //RIGHT Input
  53. if keyboard_check_pressed(ord('D'))
  54.     {
  55.     if (global.ctrl_left = 1)
  56.         {
  57.         global.ctrl_left = 0;
  58.         }
  59.     hspeed = global.CharSpeed;
  60.     global.ctrl_right = 1;
  61.     }
  62.  
  63. if keyboard_check_released(ord('D'))
  64.     {
  65.     global.ctrl_right = 0;
  66.     if keyboard_check(ord('A'))
  67.         {
  68.         global.ctrl_left = 1;
  69.         hspeed = -global.CharSpeed;
  70.         }
  71.     if (global.ctrl_left = 0)
  72.         {
  73.         hspeed = 0;
  74.         }
  75.     }
  76.  
  77. //LEFT Walking Animation
  78. if (global.ctrl_left = 1 && global.ctrl_right = 0)
  79.     {
  80.     if (global.CharAnim = 'still')
  81.         {
  82.         sprite_index = sp_PlayerMov;
  83.         image_index = 6;
  84.         image_speed = 0.15;
  85.         global.CharAnim = 'moving';
  86.         global.CharDirect = 'left';
  87.         }
  88.     if (global.CharAnim = 'moving' && global.CharDirect != 'left')
  89.         {
  90.         sprite_index = sp_PlayerMov;
  91.         image_index = 6;
  92.         image_speed = 0.15;
  93.         global.CharAnim = 'moving';
  94.         global.CharDirect = 'left';
  95.         }
  96.     if (image_index > 9)
  97.         {
  98.         image_index = 6;
  99.         }
  100.     }
  101.  
  102. //LEFT Input
  103. if keyboard_check_pressed(ord('A'))
  104.     {
  105.     if (global.ctrl_right = 1)
  106.         {
  107.         global.ctrl_right = 0;
  108.         }
  109.     hspeed = -global.CharSpeed;
  110.     global.ctrl_left = 1;
  111.     }
  112.  
  113. if keyboard_check_released(ord('A'))
  114.     {
  115.     global.ctrl_left = 0;
  116.     if keyboard_check(ord('D'))
  117.         {
  118.         global.ctrl_right = 1;
  119.         hspeed = global.CharSpeed;
  120.         }
  121.     if (global.ctrl_right = 0)
  122.         {
  123.         hspeed = 0;
  124.         }
  125.     }
  126.    
  127. //UP Walking Animation
  128. if (global.ctrl_up = 1 && global.ctrl_down = 0 && global.ctrl_left = 0 && global.ctrl_right = 0)
  129.     {
  130.     if (global.CharAnim = 'still')
  131.         {
  132.         sprite_index = sp_PlayerMov;
  133.         image_index = 11;
  134.         image_speed = 0.15;
  135.         global.CharAnim = 'moving';
  136.         global.CharDirect = 'up';
  137.         }
  138.     if (global.CharAnim = 'moving' && global.CharDirect != 'up')
  139.         {
  140.         sprite_index = sp_PlayerMov;
  141.         image_index = 11;
  142.         image_speed = 0.15;
  143.         global.CharAnim = 'moving';
  144.         global.CharDirect = 'up';
  145.         }
  146.     if (image_index > 14)
  147.         {
  148.         image_index = 11;
  149.         }
  150.     }
  151.  
  152. //UP Input
  153. if keyboard_check_pressed(ord('W'))
  154.     {
  155.     if (global.ctrl_down = 1)
  156.         {
  157.         global.ctrl_down = 0;
  158.         }
  159.     vspeed = -global.CharSpeed;
  160.     global.ctrl_up = 1;
  161.     }
  162.  
  163. if keyboard_check_released(ord('W'))
  164.     {
  165.     global.ctrl_up = 0;
  166.     if keyboard_check(ord('S'))
  167.         {
  168.         global.ctrl_down = 1;
  169.         vspeed = global.CharSpeed;
  170.         }
  171.     if (global.ctrl_down = 0)
  172.         {
  173.         vspeed = 0;
  174.         }
  175.     }
  176.  
  177. //DOWN Walking Animation
  178. if (global.ctrl_up = 0 && global.ctrl_down = 1 && global.ctrl_left = 0 && global.ctrl_right = 0)
  179.     {
  180.     if (global.CharAnim = 'still')
  181.         {
  182.         sprite_index = sp_PlayerMov;
  183.         image_index = 16;
  184.         image_speed = 0.15;
  185.         global.CharAnim = 'moving';
  186.         global.CharDirect = 'down';
  187.         }
  188.     if (global.CharAnim = 'moving' && global.CharDirect != 'down')
  189.         {
  190.         sprite_index = sp_PlayerMov;
  191.         image_index = 16;
  192.         image_speed = 0.15;
  193.         global.CharAnim = 'moving';
  194.         global.CharDirect = 'down';
  195.         }
  196.     if (image_index > 19)
  197.         {
  198.         image_index = 16;
  199.         }
  200.     }
  201.  
  202. //DOWN Input
  203. if keyboard_check_pressed(ord('S'))
  204.     {
  205.     if (global.ctrl_up = 1)
  206.         {
  207.         global.ctrl_up = 0;
  208.         }
  209.     vspeed = global.CharSpeed;
  210.     global.ctrl_down = 1;
  211.     }
  212.  
  213. if keyboard_check_released(ord('S'))
  214.     {
  215.     global.ctrl_down = 0;
  216.     if keyboard_check(ord('W'))
  217.         {
  218.         global.ctrl_up = 1;
  219.         vspeed = -global.CharSpeed;
  220.         }
  221.     if (global.ctrl_up = 0)
  222.         {
  223.         vspeed = 0;
  224.         }
  225.     }
  226.  
  227. //Boundaries
  228. obj_Player.x = clamp(obj_Player.x, sprite_width/2 ,room_width - sprite_width/2);
  229. obj_Player.y = clamp(obj_Player.y, sprite_height/2 ,room_height - sprite_height/2);
  230.  
  231. //VIEW
  232. view_object[0] = obj_Player;
  233. view_hborder[0] = room_width/2;
  234. view_vborder[0] = room_height/2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement