-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a background image for and started on the basic battle scene.
- Loading branch information
StarArawn
authored and
StarArawn
committed
Apr 16, 2021
1 parent
37d1f82
commit a168fdf
Showing
7 changed files
with
56 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::game::GameState; | ||
|
||
pub enum BattleLocation { | ||
Mountains, | ||
} | ||
|
||
pub fn get_battle_location_texture(battle_location: BattleLocation) -> &'static str { | ||
match battle_location { | ||
BattleLocation::Mountains => { | ||
"textures/backgrounds/battle1.png" | ||
}, | ||
_ => panic!("No matching background texture found for battle location.") | ||
} | ||
} | ||
|
||
pub fn spawn_battle_screen( | ||
battle_location: BattleLocation, | ||
commands: &mut Commands, | ||
asset_server: &Res<AssetServer>, | ||
materials: &mut ResMut<Assets<ColorMaterial>>, | ||
) { | ||
let texture_handle: Handle<Texture> = asset_server.load(get_battle_location_texture(battle_location)); | ||
let background_sprite = materials.add(texture_handle.into()); | ||
commands.spawn() | ||
.insert_bundle(SpriteBundle { | ||
material: background_sprite, | ||
transform: Transform::from_xyz(0.0, 0.0, 10.0), | ||
..Default::default() | ||
}) | ||
.insert(GameState::BattleView); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod player; | ||
pub mod enemy; | ||
pub mod enemy; | ||
pub mod battle; |