Skip to content

Commit

Permalink
Add ninja sprite pack
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Dec 10, 2023
1 parent ac7ae35 commit d6db882
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 4 deletions.
Binary file added assets/image/entity/ninja/Animals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/entity/ninja/Characters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/entity/ninja/Items.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/entity/ninja/Monsters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/simulation/sprite_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ impl Plugin for SpritePackPlugin {
#[derive(AssetCollection, Resource, Reflect, Default)]
#[reflect(Resource)]
pub struct SpritePackAssets {
// None
#[asset(texture_atlas(tile_size_x = 1.0, tile_size_y = 1.0, rows = 1, columns = 1))]
#[asset(path = "image/entity/none.png")]
pub none: Handle<TextureAtlas>,

// 1-bit
#[asset(texture_atlas(tile_size_x = 10.0, tile_size_y = 10.0, rows = 17, columns = 11))]
#[asset(path = "image/entity/1-bit/Clothing.png")]
pub one_bit_clothing: Handle<TextureAtlas>,
Expand Down Expand Up @@ -77,6 +79,7 @@ pub struct SpritePackAssets {
#[asset(path = "image/entity/1-bit/Weapons.png")]
pub one_bit_weapons: Handle<TextureAtlas>,

// RPG
#[asset(path = "image/entity/rpg/armours.png")]
#[asset(texture_atlas(tile_size_x = 16.0, tile_size_y = 16.0, rows = 19, columns = 9))]
pub rpg_armours: Handle<TextureAtlas>,
Expand All @@ -95,6 +98,20 @@ pub struct SpritePackAssets {
#[asset(path = "image/entity/rpg/weapons.png")]
#[asset(texture_atlas(tile_size_x = 16.0, tile_size_y = 16.0, rows = 9, columns = 8))]
pub rpg_weapons: Handle<TextureAtlas>,

// Ninja
#[asset(path = "image/entity/ninja/Animals.png")]
#[asset(texture_atlas(tile_size_x = 16.0, tile_size_y = 16.0, rows = 1, columns = 7))]
pub ninja_animals: Handle<TextureAtlas>,
#[asset(path = "image/entity/ninja/Characters.png")]
#[asset(texture_atlas(tile_size_x = 16.0, tile_size_y = 16.0, rows = 1, columns = 56))]
pub ninja_characters: Handle<TextureAtlas>,
#[asset(path = "image/entity/ninja/Items.png")]
#[asset(texture_atlas(tile_size_x = 16.0, tile_size_y = 16.0, rows = 1, columns = 2))]
pub ninja_items: Handle<TextureAtlas>,
#[asset(path = "image/entity/ninja/Monsters.png")]
#[asset(texture_atlas(tile_size_x = 16.0, tile_size_y = 16.0, rows = 1, columns = 13))]
pub ninja_monsters: Handle<TextureAtlas>,
}

/// A list of all available atlas metadata
Expand Down Expand Up @@ -198,6 +215,23 @@ fn load_atlas_list(mut atlas_list: ResMut<AtlasList>) {
path: "rpg_weapons",
tiles: (0..9 * 8).map(Tile::new).collect(),
},
// Ninja
Atlas {
path: "ninja_animals",
tiles: (0..7).map(Tile::new).collect(),
},
Atlas {
path: "ninja_characters",
tiles: (0..56).map(Tile::new).collect(),
},
Atlas {
path: "ninja_items",
tiles: (0..2).map(Tile::new).collect(),
},
Atlas {
path: "ninja_monsters",
tiles: (0..13).map(Tile::new).collect(),
},
]);
}

Expand All @@ -209,6 +243,7 @@ pub enum SpritePack {
None,
OneBit,
Rpg,
Ninja,
}

impl SpritePack {
Expand All @@ -217,6 +252,7 @@ impl SpritePack {
Self::None => 0..1,
Self::OneBit => 1..14,
Self::Rpg => 14..20,
Self::Ninja => 20..24,
}
}

Expand Down
25 changes: 21 additions & 4 deletions src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ fn load_upgrade_sequence(mut commands: Commands) {
),
(vec![ImportLibrary, SplashOfLifePlugin], String::new()),
(
vec![SpritePackOneBit, SpritePackRpg, Coffee],
vec![SpritePackOneBit, SpritePackRpg, SpritePackNinja, Coffee],
"\"I should also make the game look pretty for a higher Presentation score.\""
.to_string(),
),
Expand Down Expand Up @@ -408,8 +408,8 @@ generate_upgrade_list!(
name: "Sprite Pack (1-bit)".to_string(),
desc: "Downloads a 1-bit sprite pack for your entities. Makes your game prettier.".to_string(),
tech_debt: 1.0,
presentation_score: 10.0,
base_cost: 25.0,
presentation_score: 5.0,
base_cost: 20.0,
install: Some(world.register_system(|
mut events: EventWriter<SpritePackEvent>,
mut simulation: ResMut<Simulation>,
Expand All @@ -426,7 +426,7 @@ generate_upgrade_list!(
desc: "Downloads an RPG sprite pack for your entities. Makes your game prettier.".to_string(),
tech_debt: 1.0,
presentation_score: 10.0,
base_cost: 25.0,
base_cost: 30.0,
install: Some(world.register_system(|
mut events: EventWriter<SpritePackEvent>,
mut simulation: ResMut<Simulation>,
Expand All @@ -438,6 +438,23 @@ generate_upgrade_list!(
..default()
},

SpritePackNinja: Upgrade {
name: "Sprite Pack (ninja)".to_string(),
desc: "Downloads a Ninja sprite pack for your entities. Makes your game prettier.".to_string(),
tech_debt: 1.0,
presentation_score: 15.0,
base_cost: 40.0,
install: Some(world.register_system(|
mut events: EventWriter<SpritePackEvent>,
mut simulation: ResMut<Simulation>,
atlas_list: Res<AtlasList>,
| {
simulation.skin_set.replace_sprite_pack(&atlas_list, SpritePack::Ninja, &mut thread_rng());
events.send(SpritePackEvent);
})),
..default()
},

SkinPlugin: Upgrade {
name: "SkinPlugin".to_string(),
desc: "Introduces a new entity skin. Makes your game prettier.".to_string(),
Expand Down

0 comments on commit d6db882

Please sign in to comment.