add to speed without behaviour

Get help using Construct 2

Post » Fri Feb 22, 2013 11:17 am

So I have a sprite moving X-30*dt. (and other speeds as well)

Is it possible to add to this "speed" relative to its current speed, or will I have to assign a movement behaviour to do so?

B
9
S
4
G
1
Posts: 104
Reputation: 2,278

Post » Fri Feb 22, 2013 2:09 pm

not sure what you are doing but how about having an instant variable on the spite (called ivSpeed ?) and doing something like

X-(ivSpeed*dt)   (I know the brackets are not doing anything but it is easier to read in my mind)

then you can alter ivSpeed value to alter the sprites speed ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,782

Post » Fri Feb 22, 2013 2:23 pm

See delta-time and framerate independence.

As @RamPackWobble says, you can use a variable instead of a fixed speed like 30, but you must also use dt when modifying the speed for it to be framerate independent.
Scirra Founder
B
386
S
229
G
87
Posts: 24,207
Reputation: 191,692

Post » Sun Feb 24, 2013 8:35 am

Thats what I need.. thanks! :)
B
9
S
4
G
1
Posts: 104
Reputation: 2,278


Return to How do I....?

Who is online

Users browsing this forum: mekonbekon, plinkie and 10 guests