Quote:
Originally posted by Kaimetsu
The movement is dependent on the heading rather than the general velocity. Maybe I should just fix it to show you.
|
Could you please? It's really just this part that needs to be fixed (well, more like changed... it's not broken, but it isn't working how I want):
NPC Code:
newspeed = this.speed+this.thrustspeed*(keydown(0)-keydown(2));
if (newspeed in <this.maxspeed*-1,this.maxspeed> ) {
this.speed = newspeed;
}
this.angle = this.dir;
this.speed would be the velocity, and this.angle should be the heading. The heading should be determined by the direction and the velocity... but I'm not into math enough to do this.
I have done something like this, but instead of using a direction, I just had a x and y speed, which would be added to as keys were held, but using angles would make other things work much more efficently -- so, if someone (*looks at Kaimetsu*, lol) can help me out here, please do.