Quote:
|
You misunderstand. The code that is intended to slow the player also changes his direction of movement. I'm not talking about the parts where he bounces off walls, I'm talking merely about the section that applies friction.
|
if (this.momentumy <= 0&&this.momentumy >= -friction){
this.momentumy = 0;
}
if (this.momentumy >= 0&&this.momentumy <= friction){
this.momentumy = 0;
}
if (this.momentumx <= 0&&this.momentumx >= -friction){
this.momentumx = 0;
}
if (this.momentumx >= 0&&this.momentumx <= friction){
this.momentumx = 0;
}
I guess I do misunderstand. I thought that adding this would check it.
--Do you mean this is a bad way to check it?
Quote:
|
No amount of playing with code will change a fundamental physical fact.
|
I didn't mean playing with the code. I meant playing, as in being able to move a char across the screen with the arrow keys playing.
Edit-- It's a shame that I didn't make this to be an airplane script.. Then I wouldn't have to bother with player speed (haven't bothered with yet but will probably be a pain) and onwall.