any ideas how to make a move object with the “transition.to” using easing in a sine curve from right to left screen?
I have tried more easing effects but with no result.
Any comment will be appreciated.
Thanks in advance
Marco
[import]uid: 7518 topic_id: 2054 reply_id: 302054[/import]
I’ve not tried having two transitions on an object, but if its possible, could you have one changing the x value and another changing the y value. Each time the y changer fires its onComplete event you would just create another transition which changes the y value in the opposite direction?
If two transitions are not possible on an object, at the same time, then just have a loop (maintained by a timer or enterFrame event?) to change the x value.
Am I on the right lines with what you’re attempting? [import]uid: 8271 topic_id: 2054 reply_id: 6041[/import]
the two transitions are in conflict that’s why only one is executed
transition.to is good only for linear transitions, i.e, move from point (x1,y1) to (x2,y2) in a straight line
you must have an enterframe listener and with that you will control both the x and y values.
for a full sine curve the formula is y=y0+a*sin(2?x/L), where ?=math.pi, y0 is the initial y value of the object, a is the amplitude (how far along the y axis you want the object to oscillate) and L is the distance along the x-axis that you want the object to move (stage width minus or plus the width of the object), and x is the x coordinate.
divide the width of the screen by n (number of steps), that will be your dx
in the enterframe listener make x increase by dx at each step, and y according to the formula above (y0, a, ?, and L are constants, only x and y change) [import]uid: 6459 topic_id: 2054 reply_id: 6062[/import]
Note that each transition is only modifying one property of the object. This stops the transitions from being in conflict. This is what I meant in my earlier post. Have you tried this? [import]uid: 8271 topic_id: 2054 reply_id: 6070[/import]
That code above by GuGuGames works great for moving the object in a sine curve. I’d like to adjust it, though, so that upon a touch event, my player moves down the screen (y axis) and then when the touch is released, the player jumps upwards on the sine wave, which is then proportionally larger based on the distance the player previously moved down the screen. Any ideas?