M
Matias Fernandez
Guest
does anyone know what's wrong?
I am trying to make a sign that says yes or no, where when I press the Z key in yes the lever goes down and when I press the Z in No the lever goes up.
but it doesn't work for me, when I press the Z key in any option, lower the lever and then I can't raise it
this is my object option(yes or no) and this is the code:
if keyboard_check_pressed(vk_down) and image_index = 0
{
image_index = 1; //option no
image_speed = 0;
}
if keyboard_check_pressed(vk_up) and image_index = 1
{
image_index = 0; //option yes
image_speed = 0;
}
if image_index = 0 and keyboard_check_pressed(ord("Z"))
{
with (obj_lever)
{
image_index = 1; //lower the lever
image_speed = 0;
}
instance_destroy(); //destroy the options
}
if image_index = 1 and keyboard_check_pressed(ord("Z"))
{
with (obj_lever)
{
image_index = 0; //raise the lever
image_speed = 0;
}
instance_destroy(); //destroy the options
}
I am trying to make a sign that says yes or no, where when I press the Z key in yes the lever goes down and when I press the Z in No the lever goes up.
but it doesn't work for me, when I press the Z key in any option, lower the lever and then I can't raise it
this is my object option(yes or no) and this is the code:
if keyboard_check_pressed(vk_down) and image_index = 0
{
image_index = 1; //option no
image_speed = 0;
}
if keyboard_check_pressed(vk_up) and image_index = 1
{
image_index = 0; //option yes
image_speed = 0;
}
if image_index = 0 and keyboard_check_pressed(ord("Z"))
{
with (obj_lever)
{
image_index = 1; //lower the lever
image_speed = 0;
}
instance_destroy(); //destroy the options
}
if image_index = 1 and keyboard_check_pressed(ord("Z"))
{
with (obj_lever)
{
image_index = 0; //raise the lever
image_speed = 0;
}
instance_destroy(); //destroy the options
}