How to repeat an action?DND

W

WQX

Guest
Hi, nice to meet you all.
I want a target to be visible after 10sec and be invisible after 5sec and repeat this action until the end.

I added a set instance variable(visible,false) action and a alarm action in create event.
In the alarm event, I added a set instance variable(visible, true, relative) action and a alarm action.

but it doesn't work at all...

if i uncheck"relative", it works only once(show up, and disappear).

How can I do it by using dnd?
 

Attachments

TsukaYuriko

☄️
Forum Staff
Moderator
You'd want to set visible to !visible (the negation of visible) in the Alarm event. This way, it will act as a toggle every time the alarm is triggered.

If you want the timing to differ based on visibility, add a check for the current value of visible and set the alarm to either 10 or 5 seconds accordingly.
 

Slyddar

Member
Inside your alarm, set visible to !visible instead of true.

Edit: As stated above, you need a check in the alarm to set your time, if you want the time to differ for visible and non visible.
 
W

WQX

Guest
You'd want to set visible to !visible (the negation of visible) in the Alarm event. This way, it will act as a toggle every time the alarm is triggered.

If you want the timing to differ based on visibility, add a check for the current value of visible and set the alarm to either 10 or 5 seconds accordingly.
It really helped about the "!visible" !
I'm really a new comer to gamemaker so could you please tell me how to "add a check for the current value of visible"? I didn't find the "check" in tool box.
 
W

WQX

Guest
Inside your alarm, set visible to !visible instead of true.

Edit: As stated above, you need a check in the alarm to set your time, if you want the time to differ for visible and non visible.
I'm really a new comer to gamemaker so could you please tell me how to set a check in the alarm? cause I didn't find a "check" in tool box...
 
W

WQX

Guest
I'm really a new comer to gamemaker so could you please tell me how to set a check in the alarm? cause I didn't find a "check" in tool box...
oh I 've known how to do it! thank you!
 
Top