GameSalad

Adding and executing a smooth 'freeze everything' timer

saad1993saad1993 Posts: 47Member, BASIC
edited October 13 in Working with GS (PC)

That title scares me more than it scares you. I am attaching GIFs to help understand better. But here's the thing:
https://imgur.com/a/erZqX

In actor A, I have a rule that records it's velocity X and Y, and Angular Velocity, when Boolean game.FreezeFrame is triggered True. FreezeFrame is triggered when a touch is made less than 50 pixels around actor A. Actor A then constrains it's X and Y position to mouse(touch) movement.

What FreezeFrame does is that it stops all the actors where they are for 2 seconds. It does this by 1) Recording the value of VelX, VelY, and Ang Vel of actor A, in separate real actor attributes inside actor A. 2) The 2-second timer is inside the same rule that records the mentioned values. The timer then changes the mentioned attributes to 0 FOR 2 seconds.

After 2 seconds, another rule inside actor A checks if FreezeFrame is toggled off. If it is (which it is after 2 seconds), actor A will use the recorded values of VelX, VelY, Ang Vel, to keep moving the way it was.

Notes: 1) There is a spawner timer for actor A, which is a separate invisible actor, that is also turned off by the FreezeFrame so no more instances of actor A form during frozen period.
2) There are multiple instances of actor A on-screen at a given time.
3) The only actor moveable during FreezeFrame is the instance of actor A that was touched. It moves with the touch and drag function.

Problem:1) The instance of actor A that is touched, moves along with the touch but I want it to release right after the two seconds are up, even if touch is pressed. Basically, the 2-second timer is for the USER to be able to move the instance of actor A that is touched and place it where he/she wants on-screen. Problem is that even after the timer runs out and all other actors start moving, the touched instance of actor A sticks to the touch and stays there for a while. If I lift the mousepress/touch up, it stays there for a while and then moves.
2) Some weird walls kill other instances of actor A after FreezeFrame is over.
3) After FreezeFrame, actor A instances seem to stop at the right border and move only after the one on-screen moves out of screen from the left.

I think i'm in the right direction but there's a lot of bugs.

Hope this didn't bore you all. Help please!

Comments

Sign In or Register to comment.