diff --git a/fx/main.go b/fx/main.go index ceb8edd..fb70d76 100644 --- a/fx/main.go +++ b/fx/main.go @@ -20,24 +20,24 @@ type Fx struct { } // GameObject interface START -func (c *Fx) AnimationTick(odd bool) { - c.SpriteIdx++ - if c.SpriteIdx == c.SpriteCount && c.RepeatIdx < c.RepeatCount { - c.RepeatIdx++ - c.SpriteIdx = 0 +func (f *Fx) AnimationTick(odd bool) { + f.SpriteIdx++ + if f.SpriteIdx == f.SpriteCount && f.RepeatIdx < f.RepeatCount { + f.RepeatIdx++ + f.SpriteIdx = 0 } } -func (c *Fx) RemoveMe() bool { - return c.SpriteIdx == c.SpriteCount +func (f *Fx) RemoveMe() bool { + return f.SpriteIdx == f.SpriteCount } -func (c *Fx) IsEmpty() bool { +func (f *Fx) IsEmpty() bool { return false } -func (c *Fx) GetSpriteSheetCoordinates() logical.Vec { - return logical.V(c.SpriteVec.X+c.SpriteIdx, c.SpriteVec.Y) +func (f *Fx) GetSpriteSheetCoordinates() logical.Vec { + return logical.V(f.SpriteVec.X+f.SpriteIdx, f.SpriteVec.Y) } func (f *Fx) GetColor() color.Color { diff --git a/grid/empty.go b/grid/empty.go index 1ca6954..d22fba9 100644 --- a/grid/empty.go +++ b/grid/empty.go @@ -9,15 +9,15 @@ import ( /* Empty game object (bottom level tile) */ -const BLANK_SPRITE_X = 8 -const BLANK_SPRITE_Y = 26 +const BlankSpriteX = 8 +const BlankSpriteY = 26 type EmptyObject struct { SpriteCoordinates logical.Vec } -var EMPTY_OBJECT = EmptyObject{ - SpriteCoordinates: logical.V(BLANK_SPRITE_X, BLANK_SPRITE_Y), +var AnEmptyObject = EmptyObject{ + SpriteCoordinates: logical.V(BlankSpriteX, BlankSpriteY), } func (e EmptyObject) AnimationTick(odd bool) {} diff --git a/grid/gameobject.go b/grid/gameobject.go index 368d277..238bdc7 100644 --- a/grid/gameobject.go +++ b/grid/gameobject.go @@ -33,19 +33,19 @@ func (s *GameObjectStack) SetBoardPosition(v logical.Vec) { (*s)[0].SetBoardPosition(v) } -const DEBUG_GAMEOBJECT_REMOVAL = false +const DebugGameobjectRemoval = false func (s *GameObjectStack) AnimationTick(odd bool) { s.TopObject().AnimationTick(odd) if s.TopObject().RemoveMe() { - if DEBUG_GAMEOBJECT_REMOVAL { + if DebugGameobjectRemoval { fmt.Printf("About to remove top object from stack, len(%d)\n", len(*s)) for i, ob := range *s { fmt.Printf(" ob at idx %d is %T(%v)\n", i, ob, ob) } } s.RemoveTopObject() - if DEBUG_GAMEOBJECT_REMOVAL { + if DebugGameobjectRemoval { fmt.Printf("Did remove top object from stack, len(%d)\n", len(*s)) for i, ob := range *s { fmt.Printf(" ob at idx %d is %T(%v)\n", i, ob, ob) @@ -85,6 +85,6 @@ func (s *GameObjectStack) RemoveTopObject() GameObjectStackable { func NewGameObjectStack() *GameObjectStack { os := make(GameObjectStack, 1) - os[0] = EMPTY_OBJECT + os[0] = AnEmptyObject return &os } diff --git a/logical/vec.go b/logical/vec.go index 943e597..9bf7e03 100644 --- a/logical/vec.go +++ b/logical/vec.go @@ -111,8 +111,8 @@ func (v Vec) Path() []Vec { path := make([]Vec, 0) for Xcurrent < float64(w.X) || Ycurrent < float64(w.Y) { path = append(path, V(int(Xcurrent)*Xsign, int(Ycurrent)*Ysign)) - Xcurrent = Xcurrent + Xstep - Ycurrent = Ycurrent + Ystep + Xcurrent += Xstep + Ycurrent += Ystep } return path } diff --git a/player/player.go b/player/player.go index 6edd2b2..1e6f92b 100644 --- a/player/player.go +++ b/player/player.go @@ -4,9 +4,9 @@ import ( "fmt" "image/color" - "github.com/bobtfish/mayhem/rand" "github.com/bobtfish/mayhem/fx" "github.com/bobtfish/mayhem/logical" + "github.com/bobtfish/mayhem/rand" "github.com/bobtfish/mayhem/spells" ) diff --git a/render/sprite.go b/render/sprite.go index ebdbfda..b105e1f 100644 --- a/render/sprite.go +++ b/render/sprite.go @@ -4,7 +4,7 @@ import ( "image" "image/color" - _ "image/png" + _ "image/png" // For the side effects "io" "github.com/faiface/pixel" diff --git a/screen/attack.go b/screen/attack.go index 48c9d4c..c0417ab 100644 --- a/screen/attack.go +++ b/screen/attack.go @@ -6,12 +6,12 @@ import ( "github.com/faiface/pixel" "github.com/faiface/pixel/pixelgl" - "github.com/bobtfish/mayhem/rand" "github.com/bobtfish/mayhem/character" "github.com/bobtfish/mayhem/grid" "github.com/bobtfish/mayhem/logical" "github.com/bobtfish/mayhem/movable" "github.com/bobtfish/mayhem/player" + "github.com/bobtfish/mayhem/rand" ) type RangedCombat struct { diff --git a/screen/grow.go b/screen/grow.go index bac4b96..607dc07 100644 --- a/screen/grow.go +++ b/screen/grow.go @@ -6,11 +6,11 @@ import ( "github.com/faiface/pixel" "github.com/faiface/pixel/pixelgl" - "github.com/bobtfish/mayhem/rand" "github.com/bobtfish/mayhem/character" "github.com/bobtfish/mayhem/fx" "github.com/bobtfish/mayhem/logical" "github.com/bobtfish/mayhem/player" + "github.com/bobtfish/mayhem/rand" ) const GROW_CHANCE = 15 diff --git a/spells/main.go b/spells/main.go index c7eaf8d..75d1077 100644 --- a/spells/main.go +++ b/spells/main.go @@ -4,10 +4,10 @@ import ( "fmt" "image/color" - "github.com/bobtfish/mayhem/rand" "github.com/bobtfish/mayhem/fx" "github.com/bobtfish/mayhem/grid" "github.com/bobtfish/mayhem/logical" + "github.com/bobtfish/mayhem/rand" "github.com/bobtfish/mayhem/render" )