[Solved] How to turn a sprite using a slider?

Get help using Construct 2

Post » Tue Aug 14, 2012 11:40 pm

Hello.

I've been reading a lot of the manual entries wondering how to achieve mi sprite (a lamp) turns along with the movement of "some" slider... but i still can't do it.

Here's an image and the file:

http://dl.dropbox.com/u/48895891/APP.capx



Im just triying to get it moving into the red range, or maybe get the movement with a text entry if this wont't work.



Thanks.gilford2012-08-17 18:33:54
B
11
S
1
Posts: 5
Reputation: 1,041

Post » Wed Aug 15, 2012 3:36 am

Your images are broken, but if you just want to set the angle of an object dependent on the position of a slider, just use this formula:

angle = ((slider current X - slider initial X) * constant)

Where 'constant' will change depending on how much you want it to turn for some movement of the slider.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Aug 15, 2012 12:09 pm

Thank you so much, i'm gonna try it.
B
11
S
1
Posts: 5
Reputation: 1,041

Post » Wed Aug 15, 2012 1:56 pm

If you want to work out the constant, use this formula:

constant = object angle range / slider X range.

(it's either that or the other way around, I'm pretty sure ;))
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to How do I....?

Who is online

Users browsing this forum: linkman2004, supreme676, Yahoo [Bot] and 18 guests