energie lost overworld
Some checks failed
Rust / rustfmt (push) Failing after 24s
Rust / clippy (push) Failing after 1m26s
Rust / build (push) Successful in 3m3s

This commit is contained in:
luckyturtledev 2024-07-07 16:39:54 +02:00
parent b9e065058f
commit 2354e34142
3 changed files with 37 additions and 11 deletions

View file

@ -1,6 +1,6 @@
use crate::{activities::Activity, game::ZLayer, State};
use comfy::{
draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
delta, draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
main_camera_mut, EngineContext, IVec2, KeyCode, Vec2, RED, WHITE
};
use std::time::Instant;
@ -27,7 +27,7 @@ pub fn draw(state: &crate::State, _engine: &comfy::EngineContext<'_>) {
draw_circle(state.ghost.overworld_pos, 0.5, RED, ZLayer::Ghost.into());
}
fn update_move_player(state: &mut State, ctx: &mut EngineContext<'_>) {
fn update_move_player(state: &mut State, _ctx: &mut EngineContext<'_>) {
let now = Instant::now();
// Are there any pending position updates? If so, we ignore all user input and execute
@ -174,6 +174,15 @@ pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
}
}
// energie lost
{
let ghost = &mut state.ghost;
ghost.charge -= 70.0 * ctx.delta;
if ghost.overworld_movement_pending != Vec2::ZERO {
ghost.charge -= 70.0 * ctx.delta;
}
}
// generate more chunks if needed
{
let half_viewport = (camera.world_viewport() * 0.5 + 3.0).as_ivec2();