Skip to content

Commit

Permalink
Adding more actor types.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankopf committed Aug 4, 2023
1 parent bc316d3 commit bb90c5b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,30 @@ impl MenuStates {

#[derive(Component, PartialEq, Copy, Clone, Debug)]
pub enum ActorType { // Entity? Character? Creature? Actor? Avatar? Unit? Agent?
Human,
Dwarf,
ManCrazy,
Elf,
Teen,
Ranger,
Woman,
Man,
Man2,
ManCave,
Pig,
Rat,
}
impl ActorType {
pub fn sprite_row_and_col(&self) -> (usize, usize) {
match self {
ActorType::Human => (66, 46),
ActorType::Dwarf => (59 ,13),
ActorType::ManCrazy => (59, 15),
ActorType::Elf => (59, 18),
ActorType::Teen => (60, 11),
ActorType::Ranger => (59, 22),
ActorType::Woman => (60, 48),
ActorType::Man => (66, 46),
ActorType::Man2 => (60, 21),
ActorType::ManCave => (60, 25),
ActorType::Pig => (64, 0),
ActorType::Rat => (64, 19),
}
Expand Down
9 changes: 7 additions & 2 deletions src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ pub fn startup(
// GENERATE UNITS
for i in 1..6 {
let position = Position { x: 3, y: 3*i, z: 0 };
let sprite = TextureAtlasSprite::new(ActorType::Human.sprite_index()); // TO DO

let actor_type = match i {
1 => ActorType::Man2,
2 => ActorType::Dwarf,
_ => ActorType::Man
};
let sprite = TextureAtlasSprite::new(actor_type.sprite_index());

commands.spawn(SpriteSheetBundle {
sprite,
texture_atlas: sprite_sheet.0.clone(),
Expand Down

0 comments on commit bb90c5b

Please sign in to comment.