how can i set the speed of the custom movement to variable?

Get help using Construct 2

Post » Wed Aug 12, 2015 4:22 pm

how can i set the speed of the custom movement behaviour to global variable?

The idea is if frame is at ... set jumpstrength to ...
I also use the custom movement behaviour, so if the jumpstrength is 1000 (example) than set the custom movement speed to 500 (example) i want to do this with a global variable or a instance variable... so i set the value to the count i want... but if i set the speed to the instance or global variable it doesn't do anything...

Anyone a solution? :?:
B
6
S
2
Posts: 114
Reputation: 874

Post » Wed Aug 12, 2015 9:12 pm

global var jumpStrength = 0
global var frames = 0

Every tick:
-- Add to: frames: 1
-- Set value: jumpStrength: frames / 60

This will increase the jumpstrength in a linear fashion by roughly 1 unit per second indefinitely.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Wed Aug 12, 2015 10:12 pm

@gumshoe2029 if you want to increase a value of 1 unit per second and want to be framerate independent, your formula must be:

Every tick:
-- Add to: jumpStrength: dt

https://www.scirra.com/tutorials/67/delta-time-and-framerate-independence
B
15
S
6
Posts: 105
Reputation: 1,356


Return to How do I....?

Who is online

Users browsing this forum: John Cutter and 5 guests