How do I slow down slowly

Get help using Construct 2

Post » Tue Dec 16, 2014 11:46 pm

so i have a boat that has custom movement.
somewhere on press W i set it's custom movement speed to 50 - and it works good. then i release the key
and i want it to slowly get down to 0 speed.

i've tried:
system every 1.0 sec && boat.custommovement.speed >0 set boat.custommovement.speed-10 - doesn't work

tried the same invoking a function - doesn't work
tried the same with every tick - doesn't work
tried recursion in function - breaks the javascript


so how exactly do i do it correctly?
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
41
S
14
G
12
Posts: 623
Reputation: 9,359

Post » Wed Dec 17, 2014 12:00 am

I'm not sure how custom movement works, but try

W is down -> Set speed to 50
Else -> Set speed to max(boat.custommovement.speed - (60 * dt), 0)

(to make an Else event, select the "W is down" event and press X). Change the 60 to a lower value so it slows down slower
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests