OmegaGamingHunters

PlayerStep Event

Sep 7th, 2019
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.76 KB | None | 0 0
  1. //Frisk's Inputs//
  2. global.InputLeft = keyboard_check(vk_left);
  3. global.InputRight = keyboard_check(vk_right);
  4. global.InputUp = keyboard_check(vk_up);
  5. global.InputDown = keyboard_check(vk_down);
  6.  
  7. if (global.Chara_Mode == true)
  8. {
  9.     global.Frisk_walkdown = spr_frisk_walkdown_possessed;
  10.     global.Frisk_walkup = spr_frisk_walkup_possessed;
  11.     global.Frisk_walkleft = spr_frisk_walkleft_possessed;
  12.     global.Frisk_walkright = spr_frisk_walkright_possessed;
  13.  
  14.     global.Frisk_down_idle = spr_frisk_down_idle_possessed;
  15.     global.Frisk_up_idle = spr_frisk_up_idle_possessed;
  16.     global.Frisk_left_idle = spr_frisk_left_idle_possessed;
  17.     global.Frisk_right_idle = spr_frisk_right_idle_possessed;
  18. }
  19.  
  20. if (global.Frisk_shake == true)
  21. {
  22.     if (Frisk_Shakes == 1)
  23.     {
  24.         x += 1;
  25.         Frisk_Shakes = 2;
  26.     }
  27.     else if (Frisk_Shakes == 2)
  28.     {
  29.         x -= 1;
  30.         Frisk_Shakes = 1;
  31.     }
  32. }
  33. //Frisk's State Actions
  34. if (Frisk_State == PlayerStates.Normal)
  35. {
  36.     //Frisk's Movement
  37.     image_speed = 0;
  38.    
  39.     if ((global.InputUp) and not place_meeting(x, y-3, obj_solid))
  40.     {
  41.         y -= global.Extra_WalkSpeed;
  42.         sprite_index = global.Frisk_walkup;
  43.         global.Frisk_Facing_Direction = 1;
  44.         image_speed = 1;
  45.     }
  46.    
  47.     if ((global.InputDown) and not place_meeting(x, y+3, obj_solid))
  48.     {
  49.         y += global.Extra_WalkSpeed;
  50.         sprite_index = global.Frisk_walkdown;
  51.         global.Frisk_Facing_Direction = 2;
  52.         image_speed = 1;
  53.     }
  54.    
  55.     if ((global.InputLeft) and not place_meeting(x-3, y, obj_solid))
  56.     {
  57.         x -= global.Extra_WalkSpeed;
  58.         sprite_index = global.Frisk_walkleft;
  59.         global.Frisk_Facing_Direction = 3;
  60.         image_speed = 1;
  61.     }
  62.    
  63.     if ((global.InputRight) and not place_meeting(x+3, y, obj_solid))
  64.     {
  65.         x += global.Extra_WalkSpeed;
  66.         sprite_index = global.Frisk_walkright;
  67.         global.Frisk_Facing_Direction = 4;
  68.         image_speed = 1;
  69.     }
  70.    
  71.     //Facing direction
  72.     if (global.Frisk_Facing_Direction == 1 and !global.InputUp)
  73.     {
  74.         sprite_index = global.Frisk_up_idle;
  75.         image_index = 0;
  76.     }
  77.     else if (global.Frisk_Facing_Direction == 2 and !global.InputDown)
  78.     {
  79.         sprite_index = global.Frisk_down_idle;
  80.         image_index = 0;
  81.     }
  82.     else if (global.Frisk_Facing_Direction == 3 and !global.InputLeft)
  83.     {
  84.         sprite_index = global.Frisk_left_idle;
  85.         image_index = 0;
  86.     }
  87.     else if (global.Frisk_Facing_Direction == 4 and !global.InputRight)
  88.     {
  89.         sprite_index = global.Frisk_right_idle;
  90.         image_index = 0;
  91.     }
  92. }
  93. else
  94. {
  95. }
  96.  
  97. var inst = instance_place(x, y, obj_room_transfer);
  98. if (inst != noone)
  99. {
  100.     room_goto(inst.TargetRoom);
  101. }
  102.  
  103. //Freezes the player in place
  104. if (Frisk_State == PlayerStates.Frozen)
  105. {
  106.     //Disables movement for dialog
  107.     global.Extra_WalkSpeed = 0;
  108. }
  109. else
  110. {
  111.     global.Extra_WalkSpeed = 3;
  112. }
  113.  
  114. if (Frisk_State == PlayerStates.Frozen_Invisible)
  115. {
  116.     global.Extra_WalkSpeed = 0;
  117. }
  118. else
  119. {
  120.     global.Extra_WalkSpeed = 3;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment