I wanted to make a flashlight system for a horror rpg plus I'm still very new to the game maker and I'm not managing to do this try to leave the system more youPress the F key and the flashlight lights up and pressing f again the flashlight turns off both with sound effects let the code so more still do not know how to do this could someone help me please
if (keyboard_check_pressed(ord("F"))) {
light =+ 1;
}
if (light == 1) {
object_set_visible(obj_light,true)
}else if (light == 0 ) {
object_set_visible(obj_light,false)
}
if (light >= 2) {
light = 0;
}
if (keyboard_check_pressed(ord("F"))) {
light =+ 1;
}
if (light == 1) {
object_set_visible(obj_light,true)
}else if (light == 0 ) {
object_set_visible(obj_light,false)
}
if (light >= 2) {
light = 0;
}