movement via actionscript

  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

i have this code to move a clip from point a to point b. it works fine, no problems at all with the movement. the problem i am having is to stipulate what point a is. the code lets me predefine what point b will be. i can state what the x and y coords will be for that but i cannot say what the point a x and y coords wil be

a step by step to movement is below:

add code to the movieclip

Code: [ Select ]
onClipEvent(load)
frict = .2
ratio = .1
turnSp = xSp = ySp = xScSp = yScSp = 0
turnEnd = _parent.turnEnd
xEnd = _parent.xEnd
yEnd = _parent.yEnd
xscaleEnd = _parent.xscaleEnd
yscaleEnd = _parent.yscaleEnd


onClipEvent(enterFrame)
turnSp = turnSp*frict+(turnEnd-_rotation)*ratio
xSp = xSp*frict+(xEnd-_x)*ratio
ySp = ySp*frict+(yEnd-_y)*ratio
xScSp = xScSp*frict+(xscaleEnd-_xscale)*ratio
yScSp = yScSp*frict+(yscaleEnd-_yscale)*ratio
this._x += xSp
this._y += ySp
this._rotation += turnSp
this._xscale += xScSp
this._yscale += yScSp
  1. onClipEvent(load)
  2. frict = .2
  3. ratio = .1
  4. turnSp = xSp = ySp = xScSp = yScSp = 0
  5. turnEnd = _parent.turnEnd
  6. xEnd = _parent.xEnd
  7. yEnd = _parent.yEnd
  8. xscaleEnd = _parent.xscaleEnd
  9. yscaleEnd = _parent.yscaleEnd
  10. onClipEvent(enterFrame)
  11. turnSp = turnSp*frict+(turnEnd-_rotation)*ratio
  12. xSp = xSp*frict+(xEnd-_x)*ratio
  13. ySp = ySp*frict+(yEnd-_y)*ratio
  14. xScSp = xScSp*frict+(xscaleEnd-_xscale)*ratio
  15. yScSp = yScSp*frict+(yscaleEnd-_yscale)*ratio
  16. this._x += xSp
  17. this._y += ySp
  18. this._rotation += turnSp
  19. this._xscale += xScSp
  20. this._yscale += yScSp



now set the parameters for the tween on the main timeline
( on a frame or button action )

Code: [ Select ]
xEnd=475
yEnd=300
turnEnd=180
xscaleEnd = 120
yscaleEnd = 200
  1. xEnd=475
  2. yEnd=300
  3. turnEnd=180
  4. xscaleEnd = 120
  5. yscaleEnd = 200


see the problem?

i dont. would love a little help on this please!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.