add moving animation support, fix debug printing
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user