Hello friends, I have a question.
In GDevelop 5, I need to set a time for a power, that is, when I pick up an object x, that object is deleted and I get +200 in speed for 5 seconds.
The point is that I have not been able to establish the return time at normal speed but always remains with the +200 in speed.
If you can help me something, I would appreciate.
Hello friends, I have a question.
I’m having a similar issue where my speed and jump boost power items work intermittently (no problem with other timed powers). I have an object timer on these boosts, but don’t notice a decrease in speed after the time has passed.
My events look like this (for now, I’ve been playing with them so they change):
I’ve had the timer and actions arranged in different orders and such, but it’s the same result.
i don’t see that you start timer Speedtime, you should start it when collision
Then after 1s you go back to 200 speed but reset timer and i think you should stop it.
If i understood well your code that is what i would change
when you pick object x, do +200 to speed and start a timer
when the timer started is greater thsn 5 seconds, stop timer an decrease speed
If you can’t do it, post the code and.will modify
It’s so strange. My shield timers work as intended and I don’t start a timer at the beginning of the scene or on collision for them - that’s why I didn’t think it was necessary for the crystals although I’ve seen the examples for timers.
But I’ve tried setting up these boosts in all kinds of ways (including from the examples, your suggestion, simulating timers with variables, etc) and the power is either not activated at all or never wears off for the rest of the level.
you can send the code I’ll check. I think if you don’t start the timer it is started the first time you use it like variables.
So your timer starts the first time the game runs and you didn’t stop the timer, maybe there is something else in the code.
Be carefull with names of variables, specially timers.
This is currently my code
I usually keep the names as simple as possible. Everything was working reasonably well without the resets at the beginning for a while, then changed at some point and I haven’t been able to find the solution. But I’m trying again.
when you reset timers they start counting. If i understood what you want is to do high speed only for 1second.
How do you set velocity to object with s force? could you show the code?
I’m on the phone, so i’m writing from my head
at beginning pause timers…
oopsss! i think i’ve found the problem. You delete object so the timer is destroyed with it. Use scene timers instead if object timers
You need to reset the timer at the time of collision, and indeed, you probably cannot use an object timer if you delete the object.
Yes, I’m just trying to modify the existing platform behavior settings on the player object for a limited time after colliding with specific types of crystals. The screenshots I posted before is all the code there is that pertains to powers (for the speed boost anyway).
I have the timer set to 1 second for testing. I’d really like the boost powers to last for at least 2-3 seconds, but changing the amount of time when I’m finished testing isn’t a big deal - I’m not having trouble with that part.
They were scene timers to begin with and it wasn’t working, which is why I changed them to object timers like the shields, which again, do work properly even though the shield object also gets deleted and the timers for them aren’t reset at the time of collision.
Update: the attached events seem to be working fine. It can maybe use some tweaks, but it does the job. After a while, I got the speed boost working but the jumps weren’t on levels where it’s kind of crucial that they do.
Please feel free to try how I have my events set up and let me know if you need help.
hi It will be easier to modify the json and not image
Hi, I didn’t post that for it to be modified It’s an example only to show the events.
oops my bad. So os it working now?
No worries! Yes, it’s good now, thank you and @Gruk
Thank you!! I used the same code and it worked.