mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-17 04:45:02 +01:00
Allow changing player position in debug panel, add terminal velocity limiter
This commit is contained in:
parent
beabf269e5
commit
98965a8c86
1 changed files with 10 additions and 4 deletions
|
|
@ -85,6 +85,7 @@ impl App {
|
||||||
if self.kb_input.pressed(Key::Up) {
|
if self.kb_input.pressed(Key::Up) {
|
||||||
self.game.player.vspeed = -14.0;
|
self.game.player.vspeed = -14.0;
|
||||||
}
|
}
|
||||||
|
self.game.player.vspeed = self.game.player.vspeed.clamp(-80., 80.);
|
||||||
self.game
|
self.game
|
||||||
.player
|
.player
|
||||||
.col_en
|
.col_en
|
||||||
|
|
@ -153,11 +154,11 @@ impl App {
|
||||||
|
|
||||||
fn debug_panel_ui(debug: &mut DebugState, game: &mut GameState, ctx: &egui::Context) {
|
fn debug_panel_ui(debug: &mut DebugState, game: &mut GameState, ctx: &egui::Context) {
|
||||||
egui::Window::new("Debug (F12)").show(ctx, |ui| {
|
egui::Window::new("Debug (F12)").show(ctx, |ui| {
|
||||||
|
if debug.freecam {
|
||||||
ui.label("Cam x");
|
ui.label("Cam x");
|
||||||
ui.add(egui::DragValue::new(&mut game.camera_offset.x));
|
ui.add(egui::DragValue::new(&mut game.camera_offset.x));
|
||||||
ui.label("Cam y");
|
ui.label("Cam y");
|
||||||
ui.add(egui::DragValue::new(&mut game.camera_offset.y));
|
ui.add(egui::DragValue::new(&mut game.camera_offset.y));
|
||||||
if debug.freecam {
|
|
||||||
let tp = game.camera_offset.tile_pos();
|
let tp = game.camera_offset.tile_pos();
|
||||||
imm_dbg!(tp);
|
imm_dbg!(tp);
|
||||||
ui.label(format!(
|
ui.label(format!(
|
||||||
|
|
@ -169,6 +170,10 @@ fn debug_panel_ui(debug: &mut DebugState, game: &mut GameState, ctx: &egui::Cont
|
||||||
LengthDisp(tp.x as i64 - wp_to_tp(WorldPos::CENTER) as i64)
|
LengthDisp(tp.x as i64 - wp_to_tp(WorldPos::CENTER) as i64)
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
ui.label("Player x");
|
||||||
|
ui.add(egui::DragValue::new(&mut game.player.col_en.en.pos.x));
|
||||||
|
ui.label("Player y");
|
||||||
|
ui.add(egui::DragValue::new(&mut game.player.col_en.en.pos.y));
|
||||||
let tp = game.player.center_tp();
|
let tp = game.player.center_tp();
|
||||||
imm_dbg!(tp);
|
imm_dbg!(tp);
|
||||||
ui.label(format!(
|
ui.label(format!(
|
||||||
|
|
@ -179,6 +184,7 @@ fn debug_panel_ui(debug: &mut DebugState, game: &mut GameState, ctx: &egui::Cont
|
||||||
"Player offset from center: {}",
|
"Player offset from center: {}",
|
||||||
LengthDisp(tp.x as i64 - wp_to_tp(WorldPos::CENTER) as i64)
|
LengthDisp(tp.x as i64 - wp_to_tp(WorldPos::CENTER) as i64)
|
||||||
));
|
));
|
||||||
|
ui.label(format!("Vspeed: {}", game.player.vspeed));
|
||||||
}
|
}
|
||||||
ui.separator();
|
ui.separator();
|
||||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue