Colision timer reset (solved)

Hi,

I want an action to occur moments after the colision is made, so i created a timer.

It is only working well on the first time. The other times, the action accurs right away. Not sure what i’m doing wrong.

The code i have is this:

Don’t reset the timer and check the timer in the same event
Do the check is greater in a separated event below then keep in mind what to do when the time is greater then 0.35 Pause the timer or Delete the timer from memory

Hi, i’ve messed around with the code, but perhaps i’m not understanding well yours instructions. Could you be more clear? Maybe with an example?

I came up with this, which is not working:

Just move the Timer is greater than 0.35 at the same level of the other event not inside

If i move at the same level, the action hapens right away, not after the condition above.
Also, it only seems to work if i move Timer is greater… together with the above conditions, but it only works the first time.

Maybe Im not explain correctly

Event:
Begin of the scene
Action → Reset Timer touch_platform
Action → Pause Timer touch_platform

This is when player collide with platform
Event Collision player collision
Condition:
Player collision
Trigger Once
Action: Unpause timer touch_platform
Action: Reset touch_platform

This Event is to check the timer
Event:
Condition:
The timer touch_platform is greater than 0.35
Trigger Once
Action:
Do your logic here
Reset or pause touch_platform

Like this?


Not working at the moment

No you need to add on a third event before this two
Event:
Condition
At begin of Scene
Action Reset touch_platform
Action Pause touch_platform

When player collides with platform unpause the timer.

You can also add some scene variable to ensure that the collision only happens once.
Like
At begin of scene
gs_player_platform_collided =0

When player collide with platform change it to
gs_player_platform_collided =1

So during the timer check also check if the gs_player_platform_collided =1
Then Reset or pause timeer
Set gs_player_platform_collided =0

1 Like

So, i manage to work like this:

Still have 2 issues:
1 - it performs the Tween right away the first time i start the game, then it works well.
2 - im setting 2 variables to 0 (controls and up) that should (at least its what i intended) not letting others actions be performed while all this action is occuring, and it is not working.

One thing at the begin of the scene the global must be an action not a condition

1 Like

cool, it works now.

Now is only the 2nd issue i refer. Do you see anyting wrong that is preventing it from work?
Setting the variables control and up = 0 should prevent 2 other events to work while this event is accuring, since they have the condition of = 1 to work.

2 - im setting 2 variables to 0 (controls and up) that should (at least its what i intended) not letting others actions be performed while all this action is occuring, and it is not working.

This can be achieved just with one variable named direction_to_go i.e.
direction_to_go = 0 // means go Down
direction_to_go = 1 // means go Up
So you check the value of direction_to_go in your events

mmm, i understand what you mean, but i think it is not the issue here.
I created the variables just to prevent an event to occur while the other is occuring.

Since this may be other issue, i will create a new topic.