From 1093a2c1b2a403ad80809e657db63b13d7e551f2 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Thu, 15 Feb 2024 22:44:33 +0000 Subject: [PATCH] cleanup --- animationMario.go | 4 ++-- board.go | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/animationMario.go b/animationMario.go index 2e83b00..ee2c691 100644 --- a/animationMario.go +++ b/animationMario.go @@ -54,7 +54,7 @@ func (a *Animation) animateMario() { defer a.updateMarioPosition() a.ctx.SetColor(color.Black) a.ctx.Clear() - if a.dir.X == 1 { + if a.mario.dir.X == 1 { a.ctx.DrawImageAnchored(a.mario.images[a.mario.updown], a.mario.position.X, a.mario.position.Y, 0.5, 0.5) } else { a.ctx.DrawImageAnchored(imaging.FlipH(a.mario.images[a.mario.updown]), a.mario.position.X, a.mario.position.Y, 0.5, 0.5) @@ -69,7 +69,7 @@ func (a *Animation) updateMarioPosition() { if a.mario.position.Y+a.height > a.ctx.Height() { a.mario.dir.Y = -1 a.mario.updown = "marioUp" - } else if a.position.Y-a.height < 0 { + } else if a.mario.position.Y-a.height < 0 { a.mario.updown = "marioDown" a.mario.dir.Y = 1 } diff --git a/board.go b/board.go index a454e82..031c847 100644 --- a/board.go +++ b/board.go @@ -14,16 +14,13 @@ import ( type Animation struct { ctx *gg.Context - position image.Point - dir image.Point height int width int stroke int - updown string mqmsg chan mqtt.Message msg string - mario Mario countDown int + mario Mario doorbell Doorbell } @@ -35,11 +32,9 @@ func orchestrator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) { func animate(sz image.Point, mqMessages chan mqtt.Message) *Animation { return &Animation{ ctx: gg.NewContext(sz.X, sz.Y), - dir: image.Point{1, 1}, height: 8, width: 8, stroke: 8, - updown: "marioUp", mqmsg: mqMessages, countDown: 5000, mario: Mario{