vibe coding new path for mario
All checks were successful
build rgb-board / build (push) Successful in 6m40s
All checks were successful
build rgb-board / build (push) Successful in 6m40s
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
@@ -53,7 +54,30 @@ func (a *Animation) animateMario() {
|
||||
|
||||
// what mario does every frame
|
||||
func (a *Animation) updateMarioPosition() {
|
||||
a.mario.position.X += 1 * a.mario.dir.X
|
||||
/* a.mario.position.X += 1 * a.mario.dir.X
|
||||
a.mario.position.Y += 1 * a.mario.dir.Y
|
||||
|
||||
if a.mario.position.Y+a.height > a.ctx.Height() {
|
||||
a.mario.dir.Y = -1
|
||||
a.mario.updown = "marioUp"
|
||||
} else if a.mario.position.Y-a.height < 0 {
|
||||
a.mario.updown = "marioDown"
|
||||
a.mario.dir.Y = 1
|
||||
}
|
||||
|
||||
if a.mario.position.X+a.width > a.ctx.Width() {
|
||||
a.mario.dir.X = -1
|
||||
} else if a.mario.position.X-a.width < 0 {
|
||||
a.mario.dir.X = 1
|
||||
}*/
|
||||
const (
|
||||
wavelength = 20 // Wavelength of the sine wave
|
||||
amplitude = 4 // Amplitude of the sine wave
|
||||
)
|
||||
|
||||
currentTime := float64(a.ctx.Width()) / wavelength // Calculate current time based on position
|
||||
|
||||
a.mario.position.X += int(amplitude*math.Sin(2*math.Pi*currentTime/wavelength)) + 1*a.mario.dir.X
|
||||
a.mario.position.Y += 1 * a.mario.dir.Y
|
||||
|
||||
if a.mario.position.Y+a.height > a.ctx.Height() {
|
||||
|
||||
Reference in New Issue
Block a user