Ejemplo n.º 1
0
void Sprite::Update( float px, float py ) {
	Timer *timer = Timer::Instance();
	Trig *trig = Trig::Instance();
	Camera *camera = Camera::Instance();
	float a;
	int sx, sy;
	vector2D accel;
	
	/* -= the arcade way to do it =-
	a = (throttle * thrust) / mass;
	
	x += cos( ang ) * a * timer->GetMultiplier();
	y -= sin( ang ) * a * timer->GetMultiplier();
	*/
	
	a = (throttle * thrust) / mass;
	accel.Set( cos( ang ) * a, -sin( ang ) * a );

	velocity = velocity + (accel * timer->GetMultiplier());
	
	x += velocity.GetX();
	y += velocity.GetY();
	
	trig->RotatePoint( x, y, px, py, &rx, &ry, camera->GetAngle() );
	camera->WorldtoScreen( rx, ry, &sx, &sy );

	this->sx = sx;
	this->sy = sy;
}