Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
New scenes part 3 (#114)
Browse files Browse the repository at this point in the history
* Adding mall scene and transitions
  • Loading branch information
porkbrain authored Mar 29, 2024
1 parent 801b374 commit 78652ad
Show file tree
Hide file tree
Showing 20 changed files with 709 additions and 23 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ members = [
"common/visuals",
"main_game_lib",
"main_game",
"scenes/building1_basement1",
"scenes/building1_player_floor",
"scenes/downtown",
"scenes/mall",
"scenes/meditation",
"scenes/building1_basement1",
]


Expand Down Expand Up @@ -56,6 +57,7 @@ bevy_egui = "0.25"
scene_building1_basement1 = { path = "scenes/building1_basement1" }
scene_building1_player_floor = { path = "scenes/building1_player_floor" }
scene_downtown = { path = "scenes/downtown" }
scene_mall = { path = "scenes/mall" }
scene_meditation = { path = "scenes/meditation" }

bevy_grid_squared = { path = "bevy_grid_squared", features = ["serde"] }
Expand Down
1 change: 1 addition & 0 deletions main_game/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ main_game_lib.workspace = true
scene_building1_basement1.workspace = true
scene_building1_player_floor.workspace = true
scene_downtown.workspace = true
scene_mall.workspace = true
scene_meditation.workspace = true
156 changes: 155 additions & 1 deletion main_game/assets/maps/mall.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,157 @@
(
squares: {},
squares: {
(x: 46, y: -38): [Local(ExitZone)],
(x: 46, y: -37): [Local(ExitZone)],
(x: 46, y: -36): [Local(ExitZone)],
(x: 46, y: -35): [Local(ExitZone)],
(x: 46, y: -34): [Local(ExitZone)],
(x: 46, y: -33): [Local(ExitZone)],
(x: 46, y: -32): [Local(ExitZone)],
(x: 46, y: -31): [Local(ExitZone)],
(x: 46, y: -30): [Local(ExitZone)],
(x: 47, y: -38): [Local(ExitZone)],
(x: 47, y: -37): [Local(ExitZone)],
(x: 47, y: -36): [Local(ExitZone)],
(x: 47, y: -35): [Local(ExitZone)],
(x: 47, y: -34): [Local(ExitZone)],
(x: 47, y: -33): [Local(ExitZone)],
(x: 47, y: -32): [Local(ExitZone)],
(x: 47, y: -31): [Local(ExitZone)],
(x: 47, y: -30): [Local(ExitZone)],
(x: 48, y: -38): [Local(ExitZone)],
(x: 48, y: -37): [Local(ExitZone)],
(x: 48, y: -36): [Local(ExitZone)],
(x: 48, y: -35): [Local(ExitZone)],
(x: 48, y: -34): [Local(ExitZone)],
(x: 48, y: -33): [Local(ExitZone)],
(x: 48, y: -32): [Local(ExitZone)],
(x: 48, y: -31): [Local(ExitZone)],
(x: 48, y: -30): [Local(ExitZone)],
(x: 49, y: -38): [Local(ExitZone)],
(x: 49, y: -37): [Local(ExitZone)],
(x: 49, y: -36): [Local(ExitZone)],
(x: 49, y: -35): [Local(ExitZone)],
(x: 49, y: -34): [Local(ExitZone)],
(x: 49, y: -33): [Local(ExitZone)],
(x: 49, y: -32): [Local(ExitZone)],
(x: 49, y: -31): [Local(ExitZone)],
(x: 49, y: -30): [Local(ExitZone)],
(x: 50, y: -38): [Local(ExitZone)],
(x: 50, y: -37): [Local(ExitZone)],
(x: 50, y: -36): [Local(ExitZone)],
(x: 50, y: -35): [Local(ExitZone)],
(x: 50, y: -34): [Local(ExitZone)],
(x: 50, y: -33): [Local(ExitZone)],
(x: 50, y: -32): [Local(ExitZone)],
(x: 50, y: -31): [Local(ExitZone)],
(x: 50, y: -30): [Local(ExitZone)],
(x: 51, y: -38): [Local(ExitZone)],
(x: 51, y: -37): [Local(ExitZone)],
(x: 51, y: -36): [Local(ExitZone)],
(x: 51, y: -35): [Local(ExitZone)],
(x: 51, y: -34): [Local(ExitZone)],
(x: 51, y: -33): [Local(ExitZone)],
(x: 51, y: -32): [Local(ExitZone)],
(x: 51, y: -31): [Local(ExitZone)],
(x: 51, y: -30): [Local(ExitZone)],
(x: 52, y: -38): [Local(ExitZone)],
(x: 52, y: -37): [Local(ExitZone)],
(x: 52, y: -36): [Local(ExitZone)],
(x: 52, y: -35): [Local(ExitZone)],
(x: 52, y: -34): [Local(ExitZone)],
(x: 52, y: -33): [Local(ExitZone)],
(x: 52, y: -32): [Local(ExitZone)],
(x: 52, y: -31): [Local(ExitZone)],
(x: 52, y: -30): [Local(ExitZone)],
(x: 53, y: -38): [Local(ExitZone)],
(x: 53, y: -37): [Local(ExitZone)],
(x: 53, y: -36): [Local(ExitZone)],
(x: 53, y: -35): [Local(ExitZone)],
(x: 53, y: -34): [Local(ExitZone)],
(x: 53, y: -33): [Local(ExitZone)],
(x: 53, y: -32): [Local(ExitZone)],
(x: 53, y: -31): [Local(ExitZone)],
(x: 53, y: -30): [Local(ExitZone)],
(x: 54, y: -38): [Local(ExitZone)],
(x: 54, y: -37): [Local(ExitZone)],
(x: 54, y: -36): [Local(ExitZone)],
(x: 54, y: -35): [Local(ExitZone)],
(x: 54, y: -34): [Local(ExitZone)],
(x: 54, y: -33): [Local(ExitZone)],
(x: 54, y: -32): [Local(ExitZone)],
(x: 54, y: -31): [Local(ExitZone)],
(x: 54, y: -30): [Local(ExitZone)],
(x: 55, y: -38): [Local(ExitZone)],
(x: 55, y: -37): [Local(ExitZone)],
(x: 55, y: -36): [Local(ExitZone)],
(x: 55, y: -35): [Local(ExitZone)],
(x: 55, y: -34): [Local(ExitZone)],
(x: 55, y: -33): [Local(ExitZone)],
(x: 55, y: -32): [Local(ExitZone)],
(x: 55, y: -31): [Local(ExitZone)],
(x: 55, y: -30): [Local(ExitZone)],
(x: 56, y: -38): [Local(ExitZone)],
(x: 56, y: -37): [Local(ExitZone)],
(x: 56, y: -36): [Local(ExitZone)],
(x: 56, y: -35): [Local(ExitZone)],
(x: 56, y: -34): [Local(ExitZone)],
(x: 56, y: -33): [Local(ExitZone)],
(x: 56, y: -32): [Local(ExitZone)],
(x: 56, y: -31): [Local(ExitZone)],
(x: 56, y: -30): [Local(ExitZone)],
(x: 57, y: -38): [Local(ExitZone)],
(x: 57, y: -37): [Local(ExitZone)],
(x: 57, y: -36): [Local(ExitZone)],
(x: 57, y: -35): [Local(ExitZone)],
(x: 57, y: -34): [Local(ExitZone)],
(x: 57, y: -33): [Local(ExitZone)],
(x: 57, y: -32): [Local(ExitZone)],
(x: 57, y: -31): [Local(ExitZone)],
(x: 57, y: -30): [Local(ExitZone)],
(x: 58, y: -38): [Local(ExitZone)],
(x: 58, y: -37): [Local(ExitZone)],
(x: 58, y: -36): [Local(ExitZone)],
(x: 58, y: -35): [Local(ExitZone)],
(x: 58, y: -34): [Local(ExitZone)],
(x: 58, y: -33): [Local(ExitZone)],
(x: 58, y: -32): [Local(ExitZone)],
(x: 58, y: -31): [Local(ExitZone)],
(x: 58, y: -30): [Local(ExitZone)],
(x: 59, y: -38): [Local(ExitZone)],
(x: 59, y: -37): [Local(ExitZone)],
(x: 59, y: -36): [Local(ExitZone)],
(x: 59, y: -35): [Local(ExitZone)],
(x: 59, y: -34): [Local(ExitZone)],
(x: 59, y: -33): [Local(ExitZone)],
(x: 59, y: -32): [Local(ExitZone)],
(x: 59, y: -31): [Local(ExitZone)],
(x: 59, y: -30): [Local(ExitZone)],
(x: 60, y: -38): [Local(ExitZone)],
(x: 60, y: -37): [Local(ExitZone)],
(x: 60, y: -36): [Local(ExitZone)],
(x: 60, y: -35): [Local(ExitZone)],
(x: 60, y: -34): [Local(ExitZone)],
(x: 60, y: -33): [Local(ExitZone)],
(x: 60, y: -32): [Local(ExitZone)],
(x: 60, y: -31): [Local(ExitZone)],
(x: 60, y: -30): [Local(ExitZone)],
(x: 61, y: -38): [Local(ExitZone)],
(x: 61, y: -37): [Local(ExitZone)],
(x: 61, y: -36): [Local(ExitZone)],
(x: 61, y: -35): [Local(ExitZone)],
(x: 61, y: -34): [Local(ExitZone)],
(x: 61, y: -33): [Local(ExitZone)],
(x: 61, y: -32): [Local(ExitZone)],
(x: 61, y: -31): [Local(ExitZone)],
(x: 61, y: -30): [Local(ExitZone)],
(x: 62, y: -38): [Local(ExitZone)],
(x: 62, y: -37): [Local(ExitZone)],
(x: 62, y: -36): [Local(ExitZone)],
(x: 62, y: -35): [Local(ExitZone)],
(x: 62, y: -34): [Local(ExitZone)],
(x: 62, y: -33): [Local(ExitZone)],
(x: 62, y: -32): [Local(ExitZone)],
(x: 62, y: -31): [Local(ExitZone)],
(x: 62, y: -30): [Local(ExitZone)],
},
)
6 changes: 6 additions & 0 deletions main_game/assets/scenes/downtown.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,9 @@ metadata/category = "Default"
position = Vector2(-149, 342)

[node name="Point" type="Node" parent="Points/MallEntrance"]

[node name="InspectLabel" type="Node" parent="Points/MallEntrance"]
metadata/zone = "MallEntrance"
metadata/action = "EnterMall"
metadata/label = "Go shopping"
metadata/category = "Default"
11 changes: 11 additions & 0 deletions main_game/assets/scenes/mall.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,14 @@ position = Vector2(140, 114)
texture = ExtResource("7_34v1c")

[node name="Points" type="Node2D" parent="."]

[node name="Entrance" type="Node2D" parent="Points"]
position = Vector2(249, 133)

[node name="Point" type="Node" parent="Points/Entrance"]

[node name="InspectLabel" type="Node" parent="Points/Entrance"]
metadata/zone = "ExitZone"
metadata/action = "ExitMall"
metadata/label = "Exit"
metadata/category = "Default"
1 change: 1 addition & 0 deletions main_game/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn main() {
scene_building1_basement1::add(&mut app);
scene_meditation::add(&mut app);
scene_downtown::add(&mut app);
scene_mall::add(&mut app);

info!("Starting Don't Count The Sheep");
app.run();
Expand Down
11 changes: 11 additions & 0 deletions main_game_lib/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pub enum GlobalGameState {
AtBuilding1Basement1,
QuittingBuilding1Basement1,

LoadingMall,
AtMall,
QuittingMall,

/// Change the game state to this state to run systems that setup the
/// meditation game in the background.
/// Nothing is shown to the player yet.
Expand Down Expand Up @@ -79,6 +83,9 @@ pub enum GlobalGameStateTransition {
Building1Basement1ToDowntown,

DowntownToBuilding1PlayerFloor,
DowntownToMall,

MallToDowntown,
}

/// Typical scene has several states with standard semantics.
Expand Down Expand Up @@ -154,6 +161,10 @@ impl GlobalGameState {
None,
),

LoadingMall | AtMall | QuittingMall => {
(LoadingMall, AtMall, QuittingMall, None)
}

LoadingBuilding1Basement1
| AtBuilding1Basement1
| QuittingBuilding1Basement1 => (
Expand Down
1 change: 1 addition & 0 deletions main_game_lib/src/top_down/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ impl<T: TopDownScene> TileMap<T> {
}

// always will be included in `ACTOR_ZONE_AT_ORIGIN`
// can crash if the player is positioned outside of the map bounds
debug_assert!(self.is_on(actor_stands_at, TileKind::Actor(entity)))
}

Expand Down
9 changes: 3 additions & 6 deletions scenes/building1_basement1/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,19 @@ pub(crate) struct Plugin;
impl bevy::app::Plugin for Plugin {
fn build(&self, app: &mut App) {
app.add_systems(
OnEnter(GlobalGameState::LoadingBuilding1Basement1),
OnEnter(Building1Basement1::loading()),
rscn::start_loading_tscn::<Building1Basement1>,
)
.add_systems(
Update,
spawn
.run_if(in_state(GlobalGameState::LoadingBuilding1Basement1))
.run_if(Building1Basement1::in_loading_state())
.run_if(resource_exists::<TileMap<Building1Basement1>>)
.run_if(
rscn::tscn_loaded_but_not_spawned::<Building1Basement1>(),
),
)
.add_systems(
OnExit(GlobalGameState::QuittingBuilding1Basement1),
despawn,
);
.add_systems(OnExit(Building1Basement1::quitting()), despawn);

app.add_systems(
Update,
Expand Down
Loading

0 comments on commit 78652ad

Please sign in to comment.