aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Cholewiński <harry666t@gmail.com>2016-01-31 18:35:23 +0100
committerKamil Cholewiński <harry666t@gmail.com>2016-01-31 18:35:48 +0100
commit9588169db811607a217da96aeb343ef64b68355f (patch)
tree210fe331584cee41b5a2c6453c51595e15c43eac
parent84b991156dc4d6bd4b453a0fb024c149f6473f6d (diff)
downloadpewpew-9588169db811607a217da96aeb343ef64b68355f.zip
pewpew-9588169db811607a217da96aeb343ef64b68355f.tar.gz
pewpew-9588169db811607a217da96aeb343ef64b68355f.tar.bz2
Fix stars zooming
-rw-r--r--stars.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/stars.lua b/stars.lua
index b1ec55f..8d7d3b5 100644
--- a/stars.lua
+++ b/stars.lua
@@ -8,21 +8,22 @@ function Stars:init()
self.stars = {}
for l = 1, 4 do
self.stars[l] = {}
- for i = 1, 10 do
- self.stars[l][i] = {math.random(0, 1000),
- math.random(0, 1000)}
+ for i = 1, 20 do
+ self.stars[l][i] = {math.random(-1000, 1000),
+ math.random(-1000, 1000)}
end
end
end
function Stars:draw(camera)
love.graphics.setColor(255, 255, 255)
+ local w, h = camera:getDimensions()
for i, layer in ipairs(self.stars) do
love.graphics.push()
-- TODO: let camera handle translations
love.graphics.translate(
- -camera.x * camera.zoom * (i/10),
- -camera.y * camera.zoom * (i/10)
+ w/2 - camera.x * camera.zoom * (i/10),
+ h/2 - camera.y * camera.zoom * (i/10)
)
love.graphics.scale(camera.zoom)
love.graphics.points(layer)