energie lost overworld
This commit is contained in:
parent
b9e065058f
commit
2354e34142
3 changed files with 37 additions and 11 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue