From 95a0f895b283552079a5920f218d42f83ea02a20 Mon Sep 17 00:00:00 2001 From: Sergio Vera Castellano Date: Fri, 12 Jan 2018 12:47:16 +0100 Subject: [PATCH] Fixed image positioning --- .../parallax-scrolling-background/scrolling_background.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/community/parallax-scrolling-background/scrolling_background.go b/community/parallax-scrolling-background/scrolling_background.go index 87ba83f..8982fde 100644 --- a/community/parallax-scrolling-background/scrolling_background.go +++ b/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)), } } }