ActionScript学习笔记(五)——速度、加速度与摩擦力

一个轴,或者两个轴的速度或者加速度变化都会值得整体定义的速度在倾斜方向上的速度同意,因此考虑角速度或者角加速度更为合理;

1、考虑角速度,的速度情况

var vx:int = speed * Math.cos(angle);
var vy:int = speed * Math.sin(angle);

//位移随速度变化
sprite.x += vx;
sprite.y += vy;

2、考虑角加速度,的情况

var ax:int = force * Math.cos(angle);
var ay:int = force * Math.sin(angle);

//速度随加速度变化
vx += ax;
vy += ay;

//位移随速度变化
sprite.x += vx;
sprite.y += vy;

3、摩擦力

vx *= friction;
vy *= friction
原文地址:https://www.cnblogs.com/flashbird/p/3344186.html