add moving animation support, fix debug printing

This commit is contained in:
2024-04-16 17:46:53 +02:00
parent f2f134fddb
commit b7383f065f
7 changed files with 37 additions and 9 deletions

View File

@@ -71,6 +71,15 @@ func (position *Position) String() string {
)
}
func (position *Position) SmallString() string {
return fmt.Sprintf("%d,%d\n%d,%d",
position.X/32,
position.Y/32,
position.X,
position.Y,
)
}
func (position *Position) Move(velocity *Velocity) {
// if velocity.Direction != 0 {
// slog.Debug("moving", "velocity", velocity, "speed", speed)

View File

@@ -35,6 +35,7 @@ type Renderable struct {
DestructionAnimate Animation
IdleAnimate Animation
CollisionAnimate Animation
MovingAnimate Animation
Hidden bool
}
@@ -51,6 +52,8 @@ func (render *Renderable) StartAnimation(which int) {
render.IdleAnimate.Active = true
render.IdleAnimate.Loop = true
render.IdleAnimate.Timer.Start(0)
case Moving:
render.MovingAnimate.Loop = true
}
}