Sorry I am very new to this program and a bit confused about how I would go about using one use items/power ups. I almost have what I want but I can keep pressing Up and use the speed boost infinitely, I only want to use it once though. I want to be able to press UP and increase my speed from 255 to 300 for a few seconds then it wear off back to 255 and not be able to do it again.
Just to be clear, you want the speed boost to happen once, as in they can never hit up again for the boost after the first time?
No matter the answer to the above, you want to add the “Trigger once” condition to all 4 of those events.
Without that, every one of them happens every frame. This means that every frame Up is pressed, the timer resets. Every frame after up has been pressed, the max speed gets adjusted again, etc.
If you do want it to happen only once: Add the condition “The scene variable Speed = 0” to your “Up key is pressed” event. Then change the “Speed = 0” of the other event (The one that seds max speed to 255) to Speed = 2. Then in the final event change the variable Speed to 2, instead of 0.
Add a trigger once in here:
And also check if the scene variable Speed is 0
and check if Player has collected the PowerUp if you are not doing it separately.
thank you so much it worked! but now I noticed another issue, I must have the timers screwed up. I want it to be available to use it at any point but it seems to only work for the first few seconds when the game starts. It lasts the full 3 seconds when pressed and unable to use again like I want it but it also needs to be usable at any point during the game.
oh I was able to find a different method, I am not sure if there is a better way so feel free to let me know. But basically I just paused the speed timer at the beginning of the scene so I can use the speed boost/item at any point during the level by pressing UP key (it unpauses the timer, lasts 3 seconds then returns to normal). Thanks for your help guys, like I said if you have other methods feel free to leave them so myself and others can try them out!
Looks fine. But please add trigger once to all of those to avoid issues later.