Skip to content

Commit

Permalink
fix: better lose timer indicator ⏰
Browse files Browse the repository at this point in the history
  • Loading branch information
eerii committed Dec 11, 2023
1 parent 186585b commit 204aa76
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ a game for the bevy jam 4
- [ ] presentation (lun)
- [ ] write readme
- [ ] write jam page
- [ ] presubmit game
- [ ] submit game

- [ ] would be nice (???)
- [x] animations
Expand Down
18 changes: 16 additions & 2 deletions src/spirits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ fn check_lose_count(
mut cmd: Commands,
mut state: ResMut<NextState<GameState>>,
assets: Res<StartAssets>,
mut start: Query<(&TilePos, &mut StartTile)>,
end_timer: Res<EndTimer>,
mut start: Query<(&TilePos, &mut TileColor, &mut StartTile)>,
mut text: Query<&mut Text, With<LoseText>>,
tilemap: Query<(&TilemapLayer, &TilemapGridSize, &TilemapType, &Transform)>,
) {
for (pos, mut start) in start.iter_mut() {
for (pos, mut color, mut start) in start.iter_mut() {
let lose_text = start.lose_text;

if lose_text.is_none() {
Expand Down Expand Up @@ -214,6 +215,19 @@ fn check_lose_count(

if let Ok(mut text) = text.get_mut(lose_text.unwrap()) {
let remainder = (LOSE_COUNT - start.lose_counter) / 2. - 3.;

if remainder <= 5. {
if end_timer.0.finished() {
*color = TileColor(if color.0 == Color::default() {
Color::rgb(1.0, 0.2, 0.5)
} else {
Color::default()
});
}
} else {
*color = TileColor(Color::default());
}

text.sections[0].value = if remainder <= 0. {
"!!!".to_string()
} else if remainder > 10. {
Expand Down
2 changes: 0 additions & 2 deletions src/tilemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ fn highlight_tile(
}

for (mut tex, mut color, mut flip, pos, path, start, foreground) in tiles.iter_mut() {
*color = TileColor::default();

if let Some(sel_pos) = sel_pos.0 {
if sel_pos == *pos && path.is_none() && foreground.is_none() {
*tex = TileTextureIndex(1);
Expand Down

0 comments on commit 204aa76

Please sign in to comment.