diff --git a/examples/community/scrolling-background/README.md b/examples/community/scrolling-background/README.md index 5347004..db3ae06 100644 --- a/examples/community/scrolling-background/README.md +++ b/examples/community/scrolling-background/README.md @@ -3,3 +3,5 @@ Created by [Sergio Vera](https://github.com/svera) This example shows how to implement an infinite side scrolling background. + +Credits to [Peter Hellberg](https://github.com/peterhellberg) for the improved background image. diff --git a/examples/community/scrolling-background/gamebackground.jpg b/examples/community/scrolling-background/gamebackground.jpg deleted file mode 100644 index 050632d..0000000 Binary files a/examples/community/scrolling-background/gamebackground.jpg and /dev/null differ diff --git a/examples/community/scrolling-background/gamebackground.png b/examples/community/scrolling-background/gamebackground.png new file mode 100644 index 0000000..9338733 Binary files /dev/null and b/examples/community/scrolling-background/gamebackground.png differ diff --git a/examples/community/scrolling-background/main.go b/examples/community/scrolling-background/main.go index b606b2f..7c3c301 100644 --- a/examples/community/scrolling-background/main.go +++ b/examples/community/scrolling-background/main.go @@ -5,7 +5,7 @@ import ( "os" "time" - _ "image/jpeg" + _ "image/png" "github.com/faiface/pixel" "github.com/faiface/pixel/pixelgl" @@ -43,7 +43,7 @@ func run() { } // Pic must have double the width of the window, as it will scroll to the left - pic, err := loadPicture("gamebackground.jpg") + pic, err := loadPicture("gamebackground.png") if err != nil { panic(err) } @@ -54,8 +54,8 @@ func run() { // In the beginning, vector1 will put background1 filling the whole window, while vector2 will // put background2 just at the right side of the window, out of view - vector1 := pixel.V(windowWidth/2, (windowHeight/2)+1) - vector2 := pixel.V(windowWidth+(windowWidth/2), (windowHeight/2)+1) + vector1 := pixel.V(windowWidth/2, windowHeight/2) + vector2 := pixel.V(windowWidth+(windowWidth/2), windowHeight/2) i := float64(0) last := time.Now()