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
4
S
2
G
5
Posts: 149
Reputation: 2,025

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

Post » Sat Jan 19, 2008 10:14 pm

thanks ash, works fine !!
B
4
S
2
G
5
Posts: 149
Reputation: 2,025


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests