I’m trying to make different enemy spawn at different times, like for the first 20 seconds one thing is there, then the next 20 seconds something replaces them, and etc. etc. Please help.
If timer “spaw_enemy” = 20 seconds, create enemy
I tried what you suggested and it would create a new enemy per second.
Edit: My comment about timers using Milliseconds was wrong, I’m thinking of Music Offsets, not timers, sorry.
That said, yf you are wanting to use seconds, don’t use the expressions. Use the actual timer conditions “the timer blah is greater than x seconds”.
Close, but not quite - the first condition is going to fire every frame once timer is > 20. That should be fixable with a trigger once on each condition.
Or you add another timer for the second time check event.
I’m trying to make different enemy spawn at different times, like for the first 20 seconds one thing is there, then the next 20 seconds something replaces them
Well, this is what is requested in the post.
Yours can be used when you want to create an object when the timer reaches 20.
You are right about something missing in my code though; we should also add TimerElapsedTime(“TimeCheck”)>20 to the condition where timer < 40 is checked. Or it will trigger both conditions when timer is less than 20.
The post wanted that one thing is there for the first 20 seconds, and replaced by another object for the next 20 seconds and so on. It’s not generate a hundreds of one type of object for the first 20 seconds. The reply from JNG later on allured that they do not want a load of enemies being created, or they would have said that the solution solved it :
Oops, my bad - I mistyped and it should have read timer < 20
.
I tried it again and nothing happens, what could be the issue?
What did you try? Can you provide a screen shot of your events, so we can help you?
Well, the first condition “Left mouse button released” should be changed with whatever you want it to be. My code does not spawn an enemy every second. It just spawns the enemy when you release the mouse button.
As I said, this is a sample code; replace the first “Left mouse button released” line with whatever condition you need.
You know what? In my sleep deprived state yesterday, I completely missed it was released. Apologies. My previous comments should be disregarded.
The only thing of use that I will suggest is that the timer needs to be created first, outside that code block.
@MrMen No worries, we all have that sleepy state sometimes.
Btw, if you don’t create a timer, GDevelop creates the timers automatically doesn’t it?
Only when used in “Value of a scene timer”
GDevelop doesn’t create timers when referenced in the “Compare two numbers”,
Thanks, I didn’t know that
It looks like what you suggested only it has the greater than sign.
Is reply that to me or @Orbinho? And a screen shot is best, rather than you telling us. There have been recent threads where a simple typo was overlooked.
Have you done anything about this:
Do you initialise the timer anywhere- i.e. do you have a Reset timer TimerElapsedTime anywhere?
I have a timer so the player knows how long they played.