|
|
|
@ -26,14 +26,13 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
const SCALE: f32 = 30.0;
|
|
|
|
const SCALE: f32 = 30.0;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Component, Default, Debug, Clone, Copy, PartialEq)]
|
|
|
|
#[derive(Component, Debug, Clone, Copy, PartialEq)]
|
|
|
|
#[require(Transform, Visibility)]
|
|
|
|
#[require(Transform, Visibility)]
|
|
|
|
struct GridPosition {
|
|
|
|
struct GridPosition {
|
|
|
|
x: usize,
|
|
|
|
x: usize,
|
|
|
|
y: usize,
|
|
|
|
y: usize,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Restirct movement to within the grid
|
|
|
|
|
|
|
|
impl GridPosition {
|
|
|
|
impl GridPosition {
|
|
|
|
fn move_up(&self) -> Self {
|
|
|
|
fn move_up(&self) -> Self {
|
|
|
|
Self {
|
|
|
|
Self {
|
|
|
|
@ -64,6 +63,15 @@ impl GridPosition {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for GridPosition {
|
|
|
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
|
|
|
GridPosition {
|
|
|
|
|
|
|
|
x: 5,
|
|
|
|
|
|
|
|
y: 20,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl From<&GridPosition> for Vec3 {
|
|
|
|
impl From<&GridPosition> for Vec3 {
|
|
|
|
fn from(GridPosition { x, y }: &GridPosition) -> Vec3 {
|
|
|
|
fn from(GridPosition { x, y }: &GridPosition) -> Vec3 {
|
|
|
|
// Grid Positions start in the bottom left of the area
|
|
|
|
// Grid Positions start in the bottom left of the area
|
|
|
|
|