Here is my code from CubeWars for player movement:
public void forward() {
xpos -= (float) Math.sin(heading * CubeWars.piover180) * speed;
zpos -= (float) Math.cos(heading * CubeWars.piover180) * speed;
}
public void reverse() {
xpos += (float) Math.sin(heading * CubeWars.piover180) * speed;
zpos += (float) Math.cos(heading * CubeWars.piover180) * speed;
}
public void turnRight() {
heading -= turn;
}
public void turnLeft() {
heading += turn;
}
public void strafeRight() {;
xpos += (float) Math.cos(heading * CubeWars.piover180) * speed;
zpos -= (float) Math.sin(heading * CubeWars.piover180) * speed;
}
public void strafeLeft() {;
xpos -= (float) Math.cos(heading * CubeWars.piover180) * speed;
zpos += (float) Math.sin(heading * CubeWars.piover180) * speed;
}
Looking for suggestions on what to change on strafing to not doulbe players speed. thanks!!!