More specific timer delays

The other day while I was experimenting with a few time in preparation for when my friend finally finishes the cover art thats been holding my game back for a while, I was testing a boss fight I was going to add. I was thinking of the boss shooting a laser to the beat of the song. I had this really cool idea Nd a really neat song until I ran into a major issue. The timers delay wasnt specific enough to fire the laser at the exact correct time, and repeatedly. Unfortunately because of this Ive had to go look for new songs.
The timer activation delay you can set should be able to go further than 0.1. It could even go further, maybe 0.001. This would allow more advanced mechanics to be able to come to play while making a flowlab game, and people could add new and cooler features, or a music based boss battle like Im trying to make. One could argue people could devise troll parts of a level where it activates so rapidly it crashes a game, but there are already methods of doing this and I havent seen almost anyone actually use them. This feature could help make more advanced featured, would help with my boss battle and other people trying to make rhythm games.

This sounds great!

Something tells me that @grazer has already though about this and that its not a simple as it sounds.

What you need for this is not a better timer (which would become desynchronized from the song playback anyway), but a spectrum analyzer for the sound wave.

I have indeed looked into this, but it is not at all a simple undertaking. It’s possible that I may be able to add some sort of audio spectrum block, but it’s not a main priority since it’s a lot of work for a very narrow application.

@grazer yeah that makes sense, but if at some point youre willing to make something like that, it would help a lot with my game! thanks for bringing some light to my issue :slight_smile:

What I do for my games guns that fire faster than 0.1 second is count frames per second, keep a rolling average of that, and then have a 0 rate timer that just counts frames, and then do some math to figure out how long each frame takes. Doing it all with integer math is a little bit of a curve ball but its not so bad. This is a kinda hacky way to approach what you’re trying to do but I think it could work. Let me know if you want more info on this.

@MattKimball it sounds like a nice idea but if the frames per second is super fast i dont really want to have stacks and stacks of timers on top of each other lol

yeah it doesn’t scale well, I only use it for one object, the bullet spawner. I’m currently rewriting my gun logic and I made a timer example like this as one of the behavior bundles. Here’s a copy, if it helps anyone:


{"data":{"behavior":{"v":"2","nodes":[{"delay":2,"count":0,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":180,"y":-2592,"group":"4d59557bbc075d4e","id":"4d59557f395b8e4b"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":360,"y":-2688,"group":"4d59557bbc075d4e","id":"4d5955803dadf640","startVal":0,"tag":"conSeconds"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":360,"y":-2592,"group":"4d59557bbc075d4e","id":"4d595580021d8b44","startVal":0,"tag":"conTenths"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":-2688,"group":"4d59557bbc075d4e","id":"4d5955800828bd42","startVal":1000,"tag":"oneSecond"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-2688,"group":"4d59557bbc075d4e","id":"4d59558051461045","startVal":200,"tag":"twoTenth"},{"expression":"B/A","default0":0,"default1":0,"tag":"oneFrame","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":540,"y":-2816,"group":"4d59557bbc075d4e","id":"4d595587f694134e"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":540,"y":-2688,"group":"4d59557bbc075d4e","id":"4d595587fe38a846","startVal":0,"tag":"oneFrame"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":540,"y":-2592,"group":"4d59557bbc075d4e","id":"4d59558766afcf4a","startVal":0,"tag":"guessTime"},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":0,"y":-2560,"group":"4d59557bbc075d4e","id":"4d59558869128744"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":360,"y":-2816,"group":"4d59557bbc075d4e","id":"4d595588e6ae3b42","startVal":0,"tag":"lastFPS"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-2816,"group":"4d59557bbc075d4e","id":"4d595588811a5741","startVal":0,"tag":"countFPS"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":-2816,"group":"4d59557bbc075d4e","id":"4d595588abfc1448","startVal":0,"tag":"resetFPS"},{"inputCount":1,"outputCount":4,"name":"Clock","behaviorType":"logic.components.Clock","x":0,"y":-2944,"group":"4d59557bbc075d4e","id":"4d59558898e4774f"},{"gateVal":0,"mode":"not equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":180,"y":-2944,"group":"4d59557bbc075d4e","id":"4d595589202af941"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":-180,"y":-2720,"group":"4d59557bbc075d4e","id":"4d59558a50841e47","gateType":"OR"},{"comp_x":0,"comp_y":0,"inputCount":1,"outputCount":1,"name":"Bar","behaviorType":"logic.hud.Bar","x":900,"y":-2592,"group":"4d59557bbc075d4e","id":"4d59558c6145534b","val":0,"max":1000,"frameColor":1974047,"barColor":15895052},{"expression":"A-(Math.floor(A/B)*B)","default0":0,"default1":0,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":720,"y":-2592,"group":"4d59557bbc075d4e","id":"4d59558db6906d40"}],"links":[{"input_id":"4d59557f395b8e4bi0","output_id":"4d59558869128744o0"},{"input_id":"4d59557f395b8e4bi1","output_id":"4d5955803dadf640o0"},{"input_id":"4d59558051461045i1","output_id":"4d59557f395b8e4bo0"},{"input_id":"4d5955803dadf640i2","output_id":"4d5955800828bd42o0"},{"input_id":"4d595580021d8b44i0","output_id":"4d5955803dadf640o0"},{"input_id":"4d59558766afcf4ai1","output_id":"4d5955803dadf640o0"},{"input_id":"4d595580021d8b44i1","output_id":"4d5955803dadf640o0"},{"input_id":"4d595580021d8b44i0","output_id":"4d5955803dadf640o0"},{"input_id":"4d595580021d8b44i1","output_id":"4d5955803dadf640o0"},{"input_id":"4d595580021d8b44i2","output_id":"4d59558051461045o0"},{"input_id":"4d59558766afcf4ai0","output_id":"4d595580021d8b44o0"},{"input_id":"4d5955800828bd42i1","output_id":"4d59558a50841e47o0"},{"input_id":"4d595587f694134ei1","output_id":"4d5955800828bd42o0"},{"input_id":"4d5955803dadf640i2","output_id":"4d5955800828bd42o0"},{"input_id":"4d59558db6906d40i1","output_id":"4d5955800828bd42o0"},{"input_id":"4d595580021d8b44i2","output_id":"4d59558051461045o0"},{"input_id":"4d595587f694134ei0","output_id":"4d595588e6ae3b42o0"},{"input_id":"4d595587f694134ei1","output_id":"4d5955800828bd42o0"},{"input_id":"4d595587f694134ei2","output_id":"4d595588e6ae3b42o0"},{"input_id":"4d595587fe38a846i0","output_id":"4d595587f694134eo0"},{"input_id":"4d595587fe38a846i0","output_id":"4d595587f694134eo0"},{"input_id":"4d595587fe38a846i1","output_id":"4d59558869128744o0"},{"input_id":"4d59558766afcf4ai2","output_id":"4d595587fe38a846o0"},{"input_id":"4d59558766afcf4ai0","output_id":"4d595580021d8b44o0"},{"input_id":"4d59558766afcf4ai1","output_id":"4d5955803dadf640o0"},{"input_id":"4d59558766afcf4ai2","output_id":"4d595587fe38a846o0"},{"input_id":"4d59558db6906d40i0","output_id":"4d59558766afcf4ao0"},{"input_id":"4d59558db6906d40i2","output_id":"4d59558766afcf4ao0"},{"input_id":"4d59558898e4774fi0","output_id":"4d59558869128744o0"},{"input_id":"4d595588811a5741i2","output_id":"4d59558869128744o0"},{"input_id":"4d595587fe38a846i1","output_id":"4d59558869128744o0"},{"input_id":"4d595588e6ae3b42i0","output_id":"4d595588811a5741o0"},{"input_id":"4d595588e6ae3b42i1","output_id":"4d59558a50841e47o0"},{"input_id":"4d595587f694134ei0","output_id":"4d595588e6ae3b42o0"},{"input_id":"4d595587f694134ei2","output_id":"4d595588e6ae3b42o0"},{"input_id":"4d595588811a5741i0","output_id":"4d595588abfc1448o0"},{"input_id":"4d595588811a5741i2","output_id":"4d59558869128744o0"},{"input_id":"4d595588e6ae3b42i0","output_id":"4d595588811a5741o0"},{"input_id":"4d595588abfc1448i1","output_id":"4d59558a50841e47o0"},{"input_id":"4d595588811a5741i0","output_id":"4d595588abfc1448o0"},{"input_id":"4d59558898e4774fi0","output_id":"4d59558869128744o0"},{"input_id":"4d595589202af941i0","output_id":"4d59558898e4774fo2"},{"input_id":"4d595589202af941i0","output_id":"4d59558898e4774fo2"},{"input_id":"4d595589202af941i1","output_id":"4d595589202af941o0"},{"input_id":"4d595589202af941i1","output_id":"4d595589202af941o0"},{"input_id":"4d59558a50841e47i0","output_id":"4d595589202af941o0"},{"input_id":"4d59558a50841e47i0","output_id":"4d595589202af941o0"},{"input_id":"4d595588abfc1448i1","output_id":"4d59558a50841e47o0"},{"input_id":"4d595588e6ae3b42i1","output_id":"4d59558a50841e47o0"},{"input_id":"4d5955800828bd42i1","output_id":"4d59558a50841e47o0"},{"input_id":"4d59558c6145534bi0","output_id":"4d59558db6906d40o0"},{"input_id":"4d59558db6906d40i0","output_id":"4d59558766afcf4ao0"},{"input_id":"4d59558db6906d40i1","output_id":"4d5955800828bd42o0"},{"input_id":"4d59558db6906d40i2","output_id":"4d59558766afcf4ao0"},{"input_id":"4d59558c6145534bi0","output_id":"4d59558db6906d40o0"}]}}} 

I feel like such a noob when I see people do coding like in c# editors. .__.

this is something I absolutely think it would be helpful. Timers are what I usually do, and sometimes, I want it to go with something. But sometimes, it just isn’t the exact timer, and it makes the whole thing become off sync.

Hey @ShadowAxeKid - @MattKimball copied and pasted the behaviors he’s talking about into that comment, so you can copy and paste it into your game’s behavior window. That’s what behaviors look like when they are converted to text for sharing.