How to make actor progressively slower on each collide with another actor?
Hey there,
I'm wanting to set up a rule where an actor gets progressively slower each time in collides with another group of actors. I assume I need a real or integer attribute of some sort to designate the change in speed each time? And somehow connect that to the particular group I want it to collide with??? Just wondering if anyone has any tips in setting this up?
The actor will be moving based on keyboard left right up down, and I would prefer to use 'move' rather than 'accelerate' as I just prefer the movement that way. Is it possible to set up this speed attribute when using 'move'?
Secondary question, less important as it is just an idea at this stage: I'm thinking of also having the actor revert back to the original speed after it has been stationary for a certain amount of time (eg not interacted with by user for a certain time). Which would mean more than just the usual timer function - is this even possible? eg. Is it possible for GS to count how long something hasn't been interacted with for?
Cheers!
Comments
@Lokitoes
Attached is a sample app showing how to control the slowdown on collide,
plus a recover after 5 seconds if no interaction took place.
You were in the right track with accusing that you need an attribute to store the speed, and subtracting whenever a collision takes place.
To your second question, regarding recovering speed if no interaction took place. For this just store the time when interaction stops (all keys up in this case) and have a check against game.Time if a certain amount of time has passed. See project.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Hey thanks @Hopscotch I will try this out!