Basic direct control
This commit is contained in:
@@ -33,7 +33,7 @@ fn hello_world() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn camera_setup(mut clear_color: ResMut<ClearColor>, mut commands: Commands) {
|
fn camera_setup(mut clear_color: ResMut<ClearColor>, mut commands: Commands) {
|
||||||
*clear_color = ClearColor(Color::WHITE);
|
*clear_color = ClearColor(Color::linear_rgb(0.1, 0.4, 0.7));
|
||||||
|
|
||||||
commands.spawn(Camera2d);
|
commands.spawn(Camera2d);
|
||||||
}
|
}
|
||||||
@@ -86,6 +86,8 @@ fn player_physics(mut q_player: Query<(&InputState, &mut EntityPhysics, &mut Tra
|
|||||||
physics.turn_speed -= 0.1;
|
physics.turn_speed -= 0.1;
|
||||||
} else if input.x > 0. {
|
} else if input.x > 0. {
|
||||||
physics.turn_speed += 0.1;
|
physics.turn_speed += 0.1;
|
||||||
|
} else {
|
||||||
|
physics.turn_speed *= 0.99;
|
||||||
}
|
}
|
||||||
|
|
||||||
physics.turn_speed = physics.turn_speed.clamp(-MAX_TURN_SPEED, MAX_TURN_SPEED);
|
physics.turn_speed = physics.turn_speed.clamp(-MAX_TURN_SPEED, MAX_TURN_SPEED);
|
||||||
@@ -96,7 +98,7 @@ fn player_physics(mut q_player: Query<(&InputState, &mut EntityPhysics, &mut Tra
|
|||||||
} else if input.y < 0. {
|
} else if input.y < 0. {
|
||||||
physics.speed -= 0.1;
|
physics.speed -= 0.1;
|
||||||
} else {
|
} else {
|
||||||
physics.speed *= 0.99;
|
physics.speed *= 0.999;
|
||||||
}
|
}
|
||||||
|
|
||||||
physics.speed = physics.speed.clamp(-MAX_SAILING_SPEED, MAX_SAILING_SPEED);
|
physics.speed = physics.speed.clamp(-MAX_SAILING_SPEED, MAX_SAILING_SPEED);
|
||||||
|
|||||||
Reference in New Issue
Block a user