How do I Delay something?
-
Hard to say with out knowing what the sound is for, you could add a timer
If timer >= 5 and timer <= 5.2 then
Playaudio()
Endif
or if your wanting
It to trigger for a specific spriteframe in animation you can use
If getspriteanimframe(plr) >= 5 and getspriteanimframe(plr) <= 6 then
Playaudio()
Endif
If your using the map editor you could add detectmaparea() and trigger it that way. -
@waldron what’s the timer variable for? Like what do I put in, timer = (?)
Here’s my code and the problem.
-
Hey, the timer could be set as a variable like
You have for pan, speed ect.
Timer = 0
Then in your main loop
Put the if statement in there then
You need to manipulate the timer variable else it would stay at 0 so also in your main loop try this.
Timer += .1
If timer >= 6 then
Timer = 0
Endif
The values are just examples plus you could use print(int(timer)) to help with testing. -
@waldron Sorry I’m a beginner and I still really don’t understand 😑
-
Here is how I would do it:
-
Or here is another way to do it. This time I used Fuze’s built-in setTimer() function instead. That can be used to trigger any function after a chosen time…
-
Let me know if you have any questions!
(Also, a great tip is to indent the code to make it easier to read. Put a tab before each line of code within a code block.)
-
@91pkay that's fine it can take a few attempts until things sink in, hopefully vicinitys examples help.
-
@vinicity is it possible to do with anything, for example loadmap() ?
-
All that setTimer does is tell Fuze to call a user function after a set time. That user function may of course contain anything you want, like loadMap().
The same goes for the other example. You can put whatever inside the delayed functions...