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: 102
Reputation: 2,274

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
59
S
30
G
34
Posts: 1,194
Reputation: 23,767

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
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Sun Feb 24, 2013 8:35 am

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


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, mallorcaredes and 3 guests