Fixed image positioning

This commit is contained in:
Sergio Vera Castellano 2018-01-12 12:47:16 +01:00
parent 9ea1048758
commit 95a0f895b2
1 changed files with 4 additions and 4 deletions

View File

@ -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)),
}
}
}