From 1a4130794228824fbefa95321ab8f0727db37d93 Mon Sep 17 00:00:00 2001 From: Sergio Vera Castellano Date: Fri, 12 Jan 2018 12:47:16 +0100 Subject: [PATCH 1/2] Fixed image positioning --- .../parallax-scrolling-background/scrolling_background.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/community/parallax-scrolling-background/scrolling_background.go b/examples/community/parallax-scrolling-background/scrolling_background.go index 87ba83f..8982fde 100644 --- a/examples/community/parallax-scrolling-background/scrolling_background.go +++ b/examples/community/parallax-scrolling-background/scrolling_background.go @@ -40,13 +40,13 @@ func NewScrollingBackground(pic pixel.Picture, width, height, speed float64) *Sc func (sb *ScrollingBackground) positionImages() { if sb.speed > 0 { sb.positions = [2]pixel.Vec{ - pixel.V(sb.width/2, (sb.height/2)+1), - pixel.V((sb.width/2)-sb.width, (sb.height/2)+1), + pixel.V(sb.width/2, (sb.height / 2)), + pixel.V((sb.width/2)-sb.width, (sb.height / 2)), } } else { sb.positions = [2]pixel.Vec{ - pixel.V(sb.width/2, (sb.height/2)+1), - pixel.V(sb.width+(sb.width/2), (sb.height/2)+1), + pixel.V(sb.width/2, (sb.height / 2)), + pixel.V(sb.width+(sb.width/2), (sb.height / 2)), } } } From 452ef167127b13e9f702cd46bce5037e1ec82f55 Mon Sep 17 00:00:00 2001 From: Sergio Vera Castellano Date: Fri, 12 Jan 2018 12:52:50 +0100 Subject: [PATCH 2/2] Removed unneeded parentheses --- .../parallax-scrolling-background/scrolling_background.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/community/parallax-scrolling-background/scrolling_background.go b/examples/community/parallax-scrolling-background/scrolling_background.go index 8982fde..32c5bf4 100644 --- a/examples/community/parallax-scrolling-background/scrolling_background.go +++ b/examples/community/parallax-scrolling-background/scrolling_background.go @@ -40,13 +40,13 @@ func NewScrollingBackground(pic pixel.Picture, width, height, speed float64) *Sc func (sb *ScrollingBackground) positionImages() { if sb.speed > 0 { sb.positions = [2]pixel.Vec{ - pixel.V(sb.width/2, (sb.height / 2)), - pixel.V((sb.width/2)-sb.width, (sb.height / 2)), + pixel.V(sb.width/2, sb.height/2), + pixel.V((sb.width/2)-sb.width, sb.height/2), } } else { sb.positions = [2]pixel.Vec{ - pixel.V(sb.width/2, (sb.height / 2)), - pixel.V(sb.width+(sb.width/2), (sb.height / 2)), + pixel.V(sb.width/2, sb.height/2), + pixel.V(sb.width+(sb.width/2), sb.height/2), } } }