From 843a009343bb27fa37ad6388306adbba9da5924a Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Fri, 2 May 2025 01:59:16 +0000 Subject: [PATCH] :wq --- animationMario.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/animationMario.go b/animationMario.go index 66f462d..de6f4ef 100644 --- a/animationMario.go +++ b/animationMario.go @@ -84,16 +84,18 @@ func (a *Animation) updateMarioPosition() { if a.mario.position.Y+a.height > a.ctx.Height() { a.mario.position.Y = a.ctx.Height() - a.height // Reset Y position to the top boundary a.mario.updown = "marioUp" - a.mario.dir.Y = -1 // Reverse direction when hitting bottom + a.mario.dir.Y *= -1 // Reverse direction when hitting bottom } else if a.mario.position.Y < 0 { a.mario.position.Y = 0 // Reset Y position to the bottom boundary a.mario.updown = "marioDown" - a.mario.dir.Y = 1 // Reverse direction when hitting top + a.mario.dir.Y *= -1 // Reverse direction when hitting top } if a.mario.position.X+a.width > a.ctx.Width() { - a.mario.position.X -= (a.mario.position.X + a.width - a.ctx.Width()) // Wrap around to the left side + a.mario.position.X = a.ctx.Width() - (a.mario.position.X + a.width - a.ctx.Width()) // Wrap around to the left side + a.mario.dir.X *= -1 // Reverse X direction } else if a.mario.position.X < 0 { a.mario.position.X = -(a.mario.position.X) // Wrap around to the right side + a.mario.dir.X *= -1 // Reverse X direction } }