Rotating actor with slider
skott
Member Posts: 172
Hi
I'm trying to create an actor who are rotating through a slider.
THIS IS WHAT I WANNA DO:
- If you drag the slider to the right, the actor will rotate clockwise
- If you drag the slider to the left, the actor will rotate counterclockwise
The volume slider that firemaplegames have made is really great (http://gamesalad.com/game/play/30207 ), and i'm trying to tweak that - but i can't figure it out. Can anyone help with a little assistance
I'm trying to create an actor who are rotating through a slider.
THIS IS WHAT I WANNA DO:
- If you drag the slider to the right, the actor will rotate clockwise
- If you drag the slider to the left, the actor will rotate counterclockwise
The volume slider that firemaplegames have made is really great (http://gamesalad.com/game/play/30207 ), and i'm trying to tweak that - but i can't figure it out. Can anyone help with a little assistance
Comments
i.e, if the slider is halfway, or 0.5, multiply that by 360 to get 180...
does that make sense?
firemaplegames: yes it does make sense, but i'm not that long yet. I'm still trying to understand the code you have made. I have made an actor (the rotating object) I guess that I should make some change attribute and rotation on that..
I'm no great coder at all, i'm more into graphic so maybe this is a long shot - but I know it would fit perfect to that game i'm making.
I have an actor which I move vertically by constraining the mouse position. So it is a slider. Now there is another actor in front of the slider a liitle bit offset.
I have the offset length and if I move the slider, the other actor moves with the slider.
What I want to do is the actor should move a bit quicker than the slider, so the length difference between slider and actor gets bigger and bigger.
If this makes sense to you, I would appreciate a little help.
Something like...
Constrain Actor Y Position to (Mouse Y)*1.2
If they don't start at the same point, the math gets tricky... but I don't think it's impossible.
http://gamesalad.com/game/play/37404
It might be similar to what you're asking. It uses ratios to move the content based on the slider position. (the content can be of any length)
Maybe there's something in there that you can pick apart?
Photics solution with *1.2 seems to work, but not perfect.
When I use it, my icon jumps to another position and then starts moving like I want to be moved. Now I have to try to keep it in the original position at the first click.
----
Firemaple, I want to do something very similar, but I don't know if I can use your demo.
Speaking in terms of your demo, I want the text going down, when I pull the slider down, but the first line of the text should be at the bottom, when the slider is half way.
Your demo does something like that in the other direction, but I don't know, how to change your math accordingly.
in my case:
if touch pressed on slider, I constrain the slider's Y to game.sliderY
I watch the difference between sliderY and TextY
I constrain on the text self.Y to self.Y - game.sliderY
So the slider moves the text with itself always with the same difference, where ever it was on the screen at start.
In my case the problem is, that I spawn an icon, which spawns an icon, which spawns an icon and so forth. I have no fixed height of the content, which I can watch.
I want to move the icons in the row with the slider, so those icons, which are spawned outside of the screen, can be viewed by moving the slider.
I just constrain the position.Y of the slider to game.sliderY, then I constrain position.Y to (game.sliderY - XXX)*2 on the actor (icon)
Where XXX is a number determinig the actor's position.
The slider has a max-min to not go outside of the screen.
It works like a charm!