generated from tipragot/rust
Change textures of tiles #75
|
@ -5,15 +5,15 @@ use bevy::sprite::Anchor;
|
|||
|
||||
use super::Tile;
|
||||
|
||||
/// A component that represents a selected tile.
|
||||
/// A component that mark a tile as selected.
|
||||
#[derive(Component)]
|
||||
pub struct SelectedTile;
|
||||
|
||||
/// A component that represents the selection.
|
||||
/// A component that mark an entity as a selection.
|
||||
#[derive(Component)]
|
||||
struct Selection;
|
||||
|
||||
/// A event that is triggered when a mouse button is clicked in the world.
|
||||
/// A event that is triggered when a mouse button is clicked.
|
||||
///
|
||||
/// The event contains the position of the cursor in the world.
|
||||
#[derive(Event)]
|
||||
|
@ -31,7 +31,7 @@ impl Plugin for SelectorPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
/// Handles the mouse click and gets the position of the cursor in the world.*
|
||||
/// Handles the mouse click and gets the position of the cursor in the world.
|
||||
/// Finally, it sends an event with the position of the cursor.
|
||||
fn mouse_handler(
|
||||
mouse_button_input: Res<Input<MouseButton>>,
|
||||
|
@ -64,7 +64,7 @@ fn mouse_handler(
|
|||
}
|
||||
|
||||
/// Selects the closest tile to the cursor and marks it as selected.
|
||||
/// It also marks the old selection as unselected.
|
||||
/// It also unmarks the old selection if there is one.
|
||||
fn select_closest_tile(
|
||||
mut commands: Commands,
|
||||
tiles: Query<(Entity, &Transform, &Tile)>,
|
||||
|
|
Loading…
Reference in a new issue