add moving animation support, fix debug printing
This commit is contained in:
14
grid/grid.go
14
grid/grid.go
@@ -159,24 +159,28 @@ func NewGrid(world *ecs.World,
|
||||
render.Image = tile.Sprite
|
||||
render.Pos = pos
|
||||
|
||||
if tile.Animation.OnCollision {
|
||||
switch {
|
||||
case tile.Animation.OnCollision:
|
||||
render.CollisionAnimate.Sprites = tile.Animation.CollisionSheet.Sprites
|
||||
render.CollisionAnimate.Width = tile.Animation.CollisionSheet.Width
|
||||
render.CollisionAnimate.Height = tile.Animation.CollisionSheet.Height
|
||||
}
|
||||
|
||||
if tile.Animation.OnDestruction {
|
||||
case tile.Animation.OnDestruction:
|
||||
render.DestructionAnimate.Sprites = tile.Animation.DestructionSheet.Sprites
|
||||
render.DestructionAnimate.Width = tile.Animation.DestructionSheet.Width
|
||||
render.DestructionAnimate.Height = tile.Animation.DestructionSheet.Height
|
||||
}
|
||||
|
||||
if tile.Animation.OnIdle {
|
||||
case tile.Animation.OnIdle:
|
||||
render.IdleAnimate.Sprites = tile.Animation.IdleSheet.Sprites
|
||||
render.IdleAnimate.Width = tile.Animation.IdleSheet.Width
|
||||
render.IdleAnimate.Height = tile.Animation.IdleSheet.Height
|
||||
render.StartAnimation(components.Idle)
|
||||
render.Hidden = true // we do NOT render the sprite, but the idle animation instead
|
||||
|
||||
case tile.Animation.OnMoving:
|
||||
render.MovingAnimate.Sprites = tile.Animation.IdleSheet.Sprites
|
||||
render.MovingAnimate.Width = tile.Animation.IdleSheet.Width
|
||||
render.MovingAnimate.Height = tile.Animation.IdleSheet.Height
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user