|
|
@ -54,7 +54,7 @@ func (a *Animation) animateMario() {
|
|
|
|
defer a.updateMarioPosition()
|
|
|
|
defer a.updateMarioPosition()
|
|
|
|
a.ctx.SetColor(color.Black)
|
|
|
|
a.ctx.SetColor(color.Black)
|
|
|
|
a.ctx.Clear()
|
|
|
|
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)
|
|
|
|
a.ctx.DrawImageAnchored(a.mario.images[a.mario.updown], a.mario.position.X, a.mario.position.Y, 0.5, 0.5)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
a.ctx.DrawImageAnchored(imaging.FlipH(a.mario.images[a.mario.updown]), a.mario.position.X, a.mario.position.Y, 0.5, 0.5)
|
|
|
|
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() {
|
|
|
|
if a.mario.position.Y+a.height > a.ctx.Height() {
|
|
|
|
a.mario.dir.Y = -1
|
|
|
|
a.mario.dir.Y = -1
|
|
|
|
a.mario.updown = "marioUp"
|
|
|
|
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.updown = "marioDown"
|
|
|
|
a.mario.dir.Y = 1
|
|
|
|
a.mario.dir.Y = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|