Overworld Movement #9

Merged
msrd0 merged 9 commits from move_overworld into main 2024-07-07 08:49:20 +00:00
2 changed files with 21 additions and 2 deletions
Showing only changes of commit 06ee1a411a - Show all commits

View file

@ -66,6 +66,8 @@ fn update_move_player(state: &mut State) {
requested_pos_diff = Some(diff);
requested_cost_curr = Some(tile.movement_cost_up());
requested_cost_new = Some(new_tile.movement_cost_down());
} else {
info!("Rejecting movement - cannot stand in the requested tile.");
}
}
@ -78,6 +80,8 @@ fn update_move_player(state: &mut State) {
requested_pos_diff = Some(diff);
requested_cost_curr = Some(tile.movement_cost_down());
requested_cost_new = Some(new_tile.movement_cost_up());
} else {
info!("Rejecting movement - cannot stand in the requested tile.");
}
}
@ -90,6 +94,8 @@ fn update_move_player(state: &mut State) {
requested_pos_diff = Some(diff);
requested_cost_curr = Some(tile.movement_cost_left());
requested_cost_new = Some(new_tile.movement_cost_right());
} else {
info!("Rejecting movement - cannot stand in the requested tile.");
}
}
@ -102,6 +108,8 @@ fn update_move_player(state: &mut State) {
requested_pos_diff = Some(diff);
requested_cost_curr = Some(tile.movement_cost_right());
requested_cost_new = Some(new_tile.movement_cost_left());
} else {
info!("Rejecting movement - cannot stand in the requested tile.");
}
}
@ -122,7 +130,10 @@ fn update_move_player(state: &mut State) {
state.ghost.overworld_movement_speed = match (requested_cost_curr, requested_cost_new)
{
// movement in this direction not possible
(MovementCost::Infinite, _) | (_, MovementCost::Infinite) => return,
(MovementCost::Infinite, _) | (_, MovementCost::Infinite) => {
info!("Rejecting movement - movement cost is infinite");
return;
},
// we are walking on a path
(MovementCost::Path, MovementCost::Path) => 10.0,

View file

@ -126,6 +126,7 @@ impl Tile {
match self {
Self::Grass => MovementCost::Default,
Self::Path { left: true, .. } => MovementCost::Path,
Self::Path { left: false, .. } => MovementCost::Default,
Self::Fence { left: false, .. } => MovementCost::Obstacle,
_ => MovementCost::Infinite
}
@ -134,6 +135,7 @@ impl Tile {
match self {
Self::Grass => MovementCost::Default,
Self::Path { right: true, .. } => MovementCost::Path,
Self::Path { right: false, .. } => MovementCost::Default,
Self::Fence { right: false, .. } => MovementCost::Obstacle,
_ => MovementCost::Infinite
}
@ -142,6 +144,7 @@ impl Tile {
match self {
Self::Grass => MovementCost::Default,
Self::Path { top: true, .. } => MovementCost::Path,
Self::Path { top: false, .. } => MovementCost::Default,
Self::Fence { top: false, .. } => MovementCost::Obstacle,
_ => MovementCost::Infinite
}
@ -150,7 +153,9 @@ impl Tile {
match self {
Self::Grass => MovementCost::Default,
Self::Path { bottom: true, .. } => MovementCost::Path,
Self::Path { bottom: false, .. } => MovementCost::Default,
Self::Fence { bottom: false, .. } => MovementCost::Obstacle,
Self::House { door: true, .. } => MovementCost::Path,
_ => MovementCost::Infinite
}
}
@ -313,7 +318,10 @@ impl Chunk {
fence_vert,
grass,
house(ASSETS.overworld.house_bottom_left),
house(ASSETS.overworld.house_bottom_door),
Tile::House {
door: true,
texture: ASSETS.overworld.house_bottom_door
},
house(ASSETS.overworld.house_bottom_window),
house(ASSETS.overworld.house_bottom_window),
house(ASSETS.overworld.house_bottom_right),