Selecting + Calling the piece (board.at)

selection-refactor
Elijah Voigt 2 years ago
parent 458abee8b3
commit a425a5756c

@ -1,40 +1,52 @@
# TODO # TODO
## gameplay ## 2d gameplay
Draw board based on board resource.
Background music audio. Background music audio.
Import GLTF assets and use them for drawing pawn, drone, and queens. Pick up, put down.
Audio for pick up/put down.
Menu: Start, Credits, Quit Determine valid moves.
Menu:
Start, Credits, Quit
Start -> Gameplay
States: Loading, Gameplay, Menu, Credits, Quit
Gameplay + Escape -> Overlay Menu
Menu audio Menu audio
Start -> Gameplay Turns + Manual 2 player.
Gameplay + Escape -> Overlay Menu Ownership based on placement + color based on placement.
States: Gameplay, Menu, Credits, Quit ## 3d gameplay
Pick up, put down. Import GLTF assets and use them for drawing pawn, drone, and queens.
Audio for pick up/put down. Select piece in 3d
3d hitbox
Determine valid moves. Pick up + Put down
Turns + Manual 2 player. Gravity for moving piece
Ownership based on placement + color based on placement. Visual flare for possible moves
## AI
RandoAI RandoAI
Menu: Local 2 Player / Play Against RandoAI Menu: Local 2 Player / Play Against RandoAI
Menu: settings + Settings State: Audio Volume(s), Windowing Menu: Settings + Settings State: Audio Volume(s), Windowing
## packaging ## packaging
need to set LD_LIBRARY_PATH (linux) and PATH (windows) to a local folder Need to set LD_LIBRARY_PATH (linux) and PATH (windows) to a local folder
containing the fmod .so and .dll files respectively. containing the fmod .so and .dll files respectively.
Package web version with WASM libraries
Linux: https://appimage.org/
Windows:

@ -223,8 +223,8 @@ fn cursor_position(
}); });
} }
fn selected(selected: Res<SelectedTile>) { fn selected(selected: Res<SelectedTile>, board: Res<Board>) {
if selected.idx.is_some() { selected.idx.iter().for_each(|idx| {
info!("Selected Tile: {:?}", selected.idx); info!("Selected Tile: {:?} contains {:?}", idx, board.at(idx));
} });
} }

@ -51,15 +51,10 @@ pub(crate) struct BoardIndex {
pub y: usize, pub y: usize,
} }
#[derive(Debug, Default, Resource)]
pub(crate) struct SelectedTile {
pub idx: Option<BoardIndex>,
}
impl Board { impl Board {
/// Returns the piece at the given location /// Returns the piece at the given location
pub(crate) fn _at(&self, (_x, _y): (usize, usize)) -> Option<Piece> { pub(crate) fn at(&self, BoardIndex { x, y }: &BoardIndex) -> Option<Piece> {
todo!("return piece at location") self.inner[*y][*x].clone()
} }
/// Returns a list of all pieces on the board with their location /// Returns a list of all pieces on the board with their location
@ -95,6 +90,11 @@ impl std::fmt::Display for Board {
} }
} }
#[derive(Debug, Default, Resource)]
pub(crate) struct SelectedTile {
pub idx: Option<BoardIndex>,
}
fn setup_board(mut commands: Commands) { fn setup_board(mut commands: Commands) {
use Piece::*; use Piece::*;
commands.insert_resource(Board { commands.insert_resource(Board {

Loading…
Cancel
Save