29 lines
734 B
Lua
29 lines
734 B
Lua
local Palette = require("rendering.palette")
|
|
|
|
local Stars = {}
|
|
|
|
local starList = {}
|
|
|
|
function Stars.init()
|
|
starList = {}
|
|
math.randomseed(99999)
|
|
for i = 1, 150 do
|
|
table.insert(starList, {
|
|
x = math.random(),
|
|
y = math.random() * 0.7, -- top 70% of screen
|
|
brightness = 0.2 + math.random() * 0.6,
|
|
size = 0.5 + math.random() * 1.0,
|
|
})
|
|
end
|
|
math.randomseed(os.time())
|
|
end
|
|
|
|
function Stars.draw(screenW, screenH)
|
|
local p = Palette.get()
|
|
for _, s in ipairs(starList) do
|
|
love.graphics.setColor(p.stars[1], p.stars[2], p.stars[3], s.brightness)
|
|
love.graphics.circle("fill", s.x * screenW, s.y * screenH, s.size)
|
|
end
|
|
end
|
|
|
|
return Stars
|