From 46f331aa00263a7a26b8412099465126f1af4f93 Mon Sep 17 00:00:00 2001 From: Senad Uka Date: Thu, 23 Nov 2023 20:38:34 +0100 Subject: [PATCH] All directions --- configuration/config.go | 3 +-- hero/hero.go | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/configuration/config.go b/configuration/config.go index eeca76f..e2b2843 100644 --- a/configuration/config.go +++ b/configuration/config.go @@ -13,5 +13,4 @@ const ( NorthWest ) -// var AllDirections = []Direction{North, East, South, West, NorthEast, SouthEast, SouthWest, NorthWest} -var AllDirections = []Direction{South, North, NorthEast} +var AllDirections = []Direction{North, East, South, West, NorthEast, SouthEast, SouthWest, NorthWest} diff --git a/hero/hero.go b/hero/hero.go index 5f7e5ab..70b0ef0 100644 --- a/hero/hero.go +++ b/hero/hero.go @@ -53,6 +53,28 @@ func (h *Hero) DrawHero(screen *ebiten.Image) { {201, 0}, } + movementPositions[configuration.East] = []spritePosition{ + {132, 99}, + {165, 99}, + {198, 99}, + {0, 132}, + {33, 132}, + {0, 132}, + {198, 99}, + {165, 99}, + } + + movementPositions[configuration.SouthEast] = []spritePosition{ + {33, 66}, + {66, 66}, + {99, 66}, + {132, 66}, + {165, 66}, + {132, 66}, + {99, 66}, + {66, 66}, + } + movementPositions[configuration.South] = []spritePosition{ {66, 132}, {0, 99}, @@ -63,6 +85,39 @@ func (h *Hero) DrawHero(screen *ebiten.Image) { {33, 99}, {0, 99}, } + + movementPositions[configuration.SouthWest] = []spritePosition{ + {99, 33}, + {33, 0}, + {66, 0}, + {99, 0}, + {132, 0}, + {99, 0}, + {66, 0}, + {33, 0}, + } + + movementPositions[configuration.West] = []spritePosition{ + {198, 66}, + {99, 132}, + {132, 132}, + {165, 132}, + {198, 132}, + {165, 132}, + {132, 132}, + {99, 132}, + } + + movementPositions[configuration.NorthWest] = []spritePosition{ + {0, 0}, + {132, 33}, + {165, 33}, + {198, 33}, + {0, 66}, + {198, 33}, + {165, 33}, + {132, 33}, + } p := movementPositions[h.direction][h.step%8] op := &ebiten.DrawImageOptions{}