if(wIsPressed){
movement.x += sin((player.getRotation() * 3.141592654)/ 180) * .5; //accelerates ship at a rate of 0.5 ms^2
movement.y -= cos((player.getRotation() * 3.141592654)/ 180) * .5; //accelerates ship at a rate of 0.5 ms^2
}
else if(abs(movement.x) > 0 || abs(movement.y) > 0){
double angle = (atan2(movement.x, movement.y) * 3.141592654) / 180; //finds angle of current movement vector and converts fro radians to degrees
movement.x -= sin((angle)) * 0.5; //slows down ship by 0.5 using current vector angle
movement.y += cos((angle)) * 0.5; //slows down ship by 0.5 using current vector angle
}
基本上,使用此代码后发生的情况是我的船被直接拉到屏幕底部,并且就像地面有重力一样,我不明白我做错了什么