adding / subtracting speed via a private variable

For questions about using Classic.

Post » Sat Jan 19, 2008 8:05 pm

I'm trying to adjust an objects movement speed via an adjustable private variable, and just cant seem to perform this in one action.

for example, I want the action to go :

ALWAYS : set objectA Y coordinate to current objectA Y coordinate - private variable

but I cant seem to get it right, is this possible??

thanks
B
18
S
6
G
6
Posts: 200
Reputation: 3,381

Post » Sat Jan 19, 2008 9:41 pm

It works here. If I do:

+ Always
: Set Sprite Y to .Y + 'Variable' * TimeDelta

and 'Variable' is set to 50, it moves downwards at 50 pixels per second. Notice use of TimeDelta in the expression - it's better to use pixels per second rather than pixels per frame, because games often run at varying framerates.
Scirra Founder
B
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

Post » Sat Jan 19, 2008 10:14 pm

thanks ash, works fine !!
B
18
S
6
G
6
Posts: 200
Reputation: 3,381


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests