Skip to content

Commit

Permalink
fix: Add colliders to keys on ground
Browse files Browse the repository at this point in the history
  • Loading branch information
PraxTube committed Dec 22, 2023
1 parent 81ce37d commit 7b01f1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Binary file modified assets/ui/keys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub struct GameAssets {
pub heart_empty: Handle<Image>,
#[asset(path = "ui/statue_icon.png")]
pub statue_ui_icon: Handle<Image>,
#[asset(texture_atlas(tile_size_x = 34.0, tile_size_y = 34.0, columns = 3, rows = 5))]
#[asset(texture_atlas(tile_size_x = 34.0, tile_size_y = 34.0, columns = 3, rows = 6))]
#[asset(path = "ui/keys.png")]
pub keyboard_ui: Handle<TextureAtlas>,
#[asset(path = "ui/vignette.png")]
Expand Down
11 changes: 11 additions & 0 deletions src/ui/keyboard_ui.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy::prelude::*;
use bevy_rapier2d::prelude::*;

use crate::item::statue::StatueUnlockedDelayed;
use crate::item::{ActiveItems, STATUE_COUNT};
Expand All @@ -18,6 +19,7 @@ enum Icon {
A,
D,
I,
H,
Left,
Right,
Up,
Expand All @@ -35,6 +37,7 @@ fn icon_index(icon: Icon) -> usize {
Icon::D => 9,
Icon::Right => 11,
Icon::I => 12,
Icon::H => 15,
}
}

Expand Down Expand Up @@ -64,6 +67,7 @@ fn spawn_icon(
}

commands.spawn((
Collider::cuboid(16.0, 16.0),
KeyboardIcon,
AnimationIndices {
first: index,
Expand Down Expand Up @@ -148,6 +152,13 @@ fn spawn_keyboard_ui(mut commands: Commands, assets: Res<GameAssets>) {
Vec2::new(400.0, 150.0),
true,
);
spawn_icon(
&mut commands,
texture_atlas.clone(),
Icon::H,
Vec2::new(30.0, 800.0),
true,
);
}

fn despawn_keyboard_ui(
Expand Down

0 comments on commit 7b01f1d

Please sign in to comment.