M
myemanisbob
Guest
So I'm trying to code a feature where when the player enters a certain area (represented by an object with a collide event with the player), they'll be able to press a button and "hide". I'll animate the sprite and do the enemy AI later, but right now I'm just trying to make it so that when the player "hides", they can't move until they press the button again. Problem is, the player won't stop moving.
Here are my key inputs
The key_hide is the one that is supposed to make the player hide.
Here is what I have for hiding in my Player's step event
And finally here is my collision with obj_player event in the region where they should be able to hide
Absolutely nothing is happening. I have nothing to get the player out so he should just stop and be stuck with what I have right now. I have a feeling that "hide" is resetting back to false every frame, but I don't know how or why. Any suggestions?
Here are my key inputs
Code:
if (hascontrol)
{
key_left = keyboard_check(vk_left) || keyboard_check(ord("A"));
key_right = keyboard_check(vk_right) || keyboard_check(ord("D"));
key_jump = keyboard_check_pressed(vk_space);
key_attack = keyboard_check_pressed(ord("Z"));
key_shift = keyboard_check(vk_shift);
key_leftdirection = keyboard_check_pressed(vk_left) || keyboard_check_pressed(ord("A"));
key_rightdirection = keyboard_check_pressed (vk_right) || keyboard_check_pressed(ord("D"));
key_hide = keyboard_check(vk_up) || keyboard_check(ord("W"));
}
else
{
key_right = 0
key_right = 0
key_jump = 0
key_attack = 0
key_shift = 0
key_leftdirection = 0
key_rightdirection = 0
key_hide = 0
}
Here is what I have for hiding in my Player's step event
Code:
if hide == true
{
hsp = 0
vsp = 0
}
Code:
while obj_player
{
if key_hide
{
hide = true
}
}