Skip to content

Commit

Permalink
feat: multiple improvemens and fixes 🍊
Browse files Browse the repository at this point in the history
  • Loading branch information
eerii committed Dec 10, 2023
1 parent aebe0e3 commit 1be98bb
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 111 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,35 @@ a game for the bevy jam 4
- [x] spawn end points
- [x] lose timer and visual feedback

- [ ] important tweaks (dom mañ)
- [ ] add sprites
- [x] important tweaks (dom) 0.4
- [x] add sprites
- [x] zoom out screen
- [x] limited path tiles
- [ ] end screen (win/lose)
- [x] overlay ui

- [ ] new features (dom tar)
- [ ] other river types
- [ ] new features (lun)
- [ ] end screen (win/lose)
- [ ] main menu with image
- [ ] sound and music
- [ ] other river types + bridges
- [ ] other spirit behaviour
- [ ] bridges
- [ ] overlay ui (bridge selection, n paths...)
- [ ] better path drawing

- [ ] presentation (dom tar)
- [ ] playtesting and bugfixing (lun)
- [ ] review settings menu
- [ ] profiling and optimization

- [ ] presentation (lun)
- [ ] write readme
- [ ] write jam page
- [ ] presubmit game

- [ ] would be nice (???)
- [x] animations
- [ ] better path drawing
- [ ] alternate paths
- [ ] improve lose timer
- [ ] animations
- [ ] spirit dialogues
- [ ] sound and music
- [ ] tweening and animation
- [ ] tiles only despawn after no entities are in them

- [ ] playtesting and bugfixing (lun)
- [ ] review settings menu
- [ ] profiling and optimization
</details>
Binary file added assets/sprites/coin.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/sprites/river.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 8 additions & 10 deletions src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const START_SCORES: [u32; 20] = [
5000,
];

const END_SCORES: [u32; 4] = [0, 60, 350, 3000];
const END_SCORES: [u32; 6] = [0, 60, 120, 350, 1000, 3000];

pub struct CharonPlugin;

Expand Down Expand Up @@ -127,7 +127,7 @@ fn spawn_start_end(
};

// Grow level size every 2 starts (only if we are not at the max size)
if is_start && (*start_spawned + 2) % 3 == 0 && level_size.0.x < MAP_SIZE.x {
if is_start && (*start_spawned + 3) % 4 == 0 && level_size.0.x < MAP_SIZE.x {
level_size.0.x += 2;
level_size.0.y += 2;
if let Ok(mut cam) = cam.get_single_mut() {
Expand All @@ -148,15 +148,13 @@ fn spawn_start_end(
} else {
get_spawn_pos(&offset, &size, &starts, &ends)
}
} else if *end_spawned <= 1 {
Some(TilePos {
x: offset.x + size.x - 2,
y: offset.y + size.y / 2,
})
} else {
if *end_spawned <= 1 {
Some(TilePos {
x: offset.x + size.x - 2,
y: offset.y + size.y / 2,
})
} else {
get_spawn_pos(&offset, &size, &starts, &ends)
}
get_spawn_pos(&offset, &size, &starts, &ends)
}
};

Expand Down
108 changes: 76 additions & 32 deletions src/hud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,85 @@ fn init_hud(mut cmd: Commands, assets: Res<GameAssets>, mut node: Query<Entity,
if let Ok(node) = node.get_single_mut() {
if let Some(mut node) = cmd.get_entity(node) {
node.with_children(|parent| {
parent.spawn((
TextBundle::from_section(
"<> 0",
TextStyle {
font: assets.font.clone(),
font_size: 24.0,
color: Color::WHITE,
parent
.spawn(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
left: Val::Px(5.0),
top: Val::Px(5.0),
flex_direction: FlexDirection::Row,
align_items: AlignItems::Center,
justify_content: JustifyContent::Center,
column_gap: Val::Px(4.),
..default()
},
)
.with_style(Style {
position_type: PositionType::Absolute,
right: Val::Px(5.0),
top: Val::Px(5.0),
..default()
}),
ScoreText,
));
})
.with_children(|tiles| {
tiles.spawn(ImageBundle {
image: UiImage {
texture: assets.river_icon.clone(),
..default()
},
style: Style {
width: Val::Px(24.),
..default()
},
..default()
});

parent.spawn((
TextBundle::from_section(
"[] 0",
TextStyle {
font: assets.font.clone(),
font_size: 24.0,
color: Color::WHITE,
tiles.spawn((
TextBundle::from_section(
"0",
TextStyle {
font: assets.font.clone(),
font_size: 24.0,
color: Color::WHITE,
},
),
TilesText,
));
});

parent
.spawn(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
right: Val::Px(5.0),
top: Val::Px(5.0),
flex_direction: FlexDirection::Row,
align_items: AlignItems::Center,
justify_content: JustifyContent::Center,
column_gap: Val::Px(4.),
..default()
},
)
.with_style(Style {
position_type: PositionType::Absolute,
left: Val::Px(5.0),
top: Val::Px(5.0),
..default()
}),
TilesText,
));
})
.with_children(|score| {
score.spawn((
TextBundle::from_section(
"0",
TextStyle {
font: assets.font.clone(),
font_size: 24.0,
color: Color::WHITE,
},
),
ScoreText,
));

score.spawn(ImageBundle {
image: UiImage {
texture: assets.coin_icon.clone(),
..default()
},
style: Style {
width: Val::Px(24.),
..default()
},
..default()
});
});
});
}
}
Expand All @@ -82,10 +126,10 @@ fn update_hud(
mut tiles_text: Query<&mut Text, (With<TilesText>, Without<ScoreText>)>,
) {
for mut text in score_text.iter_mut() {
text.sections[0].value = format!("<> {}", score.score);
text.sections[0].value = format!("{}", score.score);
}
for mut text in tiles_text.iter_mut() {
text.sections[0].value = format!("[] {}", tiles.0);
text.sections[0].value = format!("{}", tiles.0);
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ pub struct GameAssets {
#[asset(path = "icons/bevy.png")]
pub bevy_icon: Handle<Image>,

#[asset(path = "sprites/coin.png")]
pub coin_icon: Handle<Image>,

#[asset(path = "sprites/river.png")]
pub river_icon: Handle<Image>,

#[asset(path = "fonts/sans.ttf")]
pub font: Handle<Font>,
}
Expand Down
Loading

0 comments on commit 1be98bb

Please sign in to comment.