I’m making a part of my game where the player has to tap fast to split the cell into two. There is a green bar that adjusts its width (until the set length) to let the player know how much is left to split the cell.
What I wanted is to have the cell play an animation when certain length is reached.
example: BarWidth > 242 then change cell animation to …
I want to change cell animation when the bar reaches >242 and reverse that animation (play the animation backwards) when its <242 and;
change cell animation when the bar reaches >484 and reverse that animation (play the animation backwards) when its <484.
What I did, I think has overlapping conditions (according to chatgpt) and I don’t know how to fix this:
Haven’t tested it myself yet, But…
Try changing the sub-event with the condition: ‘TapBar < 242’ into a Main event.
Do the same for ‘TapBar < 484’
I think the events with the condition requiring TapBar to be less than 242~, can not be triggered (or will only be triggered once) when it also requires it be higher than 242~.
Next problem, since GDevelop ‘reads’ events from top to bottom you’ll need to rearrange your events a bit since TapBar > 242 and TapBar < 242 will be nullified by TapBar > 484 and TapBar < 484.
Rearrange them in this order:
TapBar > 968. (Note that if the initial BarLength variable is set above 968, it will never decrease because of this event)
TapBar > 484. Cleavage2Reverse
TapBar < 484. CleavageReverse
TapBar > 242. Cleavage
TapBar < 242. Cleavage2
This way, when the variable BarLength decreases it will trigger these Conditions one by one (it will skip the full animation if decrease too fast though)
You want to change the animation depending on whether the bar is increasing or decreasing when it crosses the 242 & 484 values. I’d suggest something like:
Putting the animation name in a variable and assigning it at the end avoids the restarting of the animation because it was changed by another event and then changed back all withing one game frame.
Hello @MrMen I wanted to add something when the TapBar length or width = 968 (max) an animation plays and deletes the TapBar so that it wont reverse the animation anymore. It’s like the final animation where my cell splits into two.
I tried doing this but it is stuck at playing the Cleavage2 animation. If it’s not too much trouble can I ask how to program/tweak this? Thank you so much.
EDIT: The final animation is “Cytokinesis”
EDIT: Also, my tapbar’s length adds so fast, is there a way to make it like grow (thewidth) slow when I press on tap? I want the players to have a little struggle I tried changing the number I’m multplying the TimeDelta with, but nothing changed.
EDIT: I found the solution for the TimeDelta etc.
EDIT: When I press on the Tap Button continuously the width of the tapbar adds continuously. I want it to trigger once so that the player has to tap fast to make the width grow. I tried adding the trigger once but the length grows until just like 10px.
Try changing the “Taps is pressed” to “Taps is clicked”. This will also slow down the increasing width.
Make sure your event is straight after the “BarLength >= 484” event.
Add a boolean scene variable, say called “TappedOut”. In the event (when BarLength > 968), set TappedOut to true as the first action. Then make all of the events in my screen snip (except for the beginning of scene) subevents of an event with “TappedOut = false” as the condition.
I don’t see Cleavage2 being played in that video. Just the animations named Cleavage and CleavageReverse.
I think one of the issues is that there may be a bit of back and forth with the animation when passing the thresholds. It may be just going over the threshold and setting the animation, only for it to dip back under the threshold a game frame or 2 later and changing the animation again.
So I’ve added a buffer to my original solution between the thresholds for cleaving and reversing the cleaving, and only reversed the cleaving depending on what the animation name is. I’ve also realised there’s a simpler way without having to use the “IsDecreasing” boolean. Here’s an update to my suggested solution: