/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
vx += (targetX - sprite.x) * spring; //'spring': elastic coefficient vy += (targetY - sprite.y) * spring; sprite.x += (vx *= friction); //'friction': friction force sprite.y += (vy *= friction); //use it inside an OnEnterFrame event handler
Comments
