#basic programming help needed

1 messages · Page 1 of 1 (latest)

rancid spear
#

so i have this simple code here:

func _on_left_button_down() -> void: if iconval == 0: $"save information/icon switcheroo/AnimatedSprite2D".play("nonogon") iconval = 13 if iconval == 13: $"save information/icon switcheroo/AnimatedSprite2D".play("octagon") iconval = 12

the thing is, i want it to make it so that after the value switches to 13, the game waits until you press the button again to switch the value to 12. but what's happening for me is that all of this code happens at once. i fully understand why this is the case, i'd just like to know how to make the game wait for the button to be pressed again

loud apex
#

elif

#

that is,

if something_is_true:
    do_this()

if something_else_is_also_true:
    do_that()

vs

if something_is_true:
    do_this()
elif something_else_is_true_instead:
    do_that()
#

("else if")