1
0

Fixed colors for Love 11.

This commit is contained in:
Jon Michael Aanes 2024-09-19 17:42:50 +02:00
parent c686c29952
commit f72ef3d92a
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
4 changed files with 26 additions and 16 deletions

View File

@ -82,7 +82,7 @@ function draw_player (x,y)
end
generate_hotspots(5, 100)
love.graphics.setBackgroundColor(100, 100, 200)
love.graphics.setBackgroundColor(100/256, 100/256, 200/256)
function love.update (dt)
update_player(dt)

View File

@ -6,6 +6,10 @@ local SPEED = 100
local FONT = love.graphics.newFont("cour.ttf", 30)
love.graphics.setFont(FONT)
local COLOR_PLANET = {100/255,200/255,100/255}
local COLOR_STARS = {1,1,1}
local stars = {}
function generate_stars (nr, mindist)
@ -86,7 +90,7 @@ local player = {
}
function draw_player (x,y)
love.graphics.setColor(255, 255, 255)
love.graphics.setColor(COLOR_STARS)
local py = player.rocket and y + math.min(0, player.rocket) or y
local PLAYER_POLY = {
x-30, py+20,
@ -144,7 +148,7 @@ function love.update (dt)
end
function draw_stars ()
love.graphics.setColor(255,255,255)
love.graphics.setColor(COLOR_STARS)
for _, star in ipairs(stars) do
love.graphics.circle("fill", star[1], star[2], 2)
end
@ -156,7 +160,7 @@ local function draw_canvas()
love.graphics.setCanvas(CANVAS)
love.graphics.clear()
draw_stars()
draw_planet(400, scroll+500, 200, {100, 200, 100})
draw_planet(400, scroll+500, 200, COLOR_PLANET)
draw_player(player.x, player.y)
if hint.time > 0 then
@ -167,10 +171,10 @@ end
function love.draw ()
draw_canvas()
love.graphics.setColor(255,255,255)
love.graphics.setColor(COLOR_STARS)
love.graphics.draw(CANVAS)
end
math.randomseed(os.time())
generate_stars(30, 100)
love.graphics.setBackgroundColor(26,26,26)
love.graphics.setBackgroundColor(26/255,26/255,26/255)

View File

@ -1,11 +1,15 @@
local COLOR_WHITE = {1,1,1}
local COLOR_PLANET = {0.8,1,0.5,1}
local COLOR_SPACE = {1,1,1,50/255}
math.randomseed(os.time())
local MOONS = {}
local t_moon = nil
for i = 1, 10 do
local color = {math.random(200),math.random(100),math.random(200)}
local moon = {500+math.random(400)-200,200+math.random(400)-200,math.random(10)+1,color}
local color = { math.random(200)/255,math.random(100)/255,math.random(200)/255 }
local moon = {500+math.random(400)-200,200+math.random(400)-200,math.random(10)+1, color = color}
table.insert(MOONS, moon)
if moon[2] > 50 and (not t_moon or math.random()>0.5) then
t_moon = moon
@ -30,14 +34,14 @@ local function generate_planet_canvas ()
]])
love.graphics.setCanvas(canvas)
love.graphics.setShader(shader)
love.graphics.setColor(255*0.8,255*1,255*0.5,255)
love.graphics.setColor(COLOR_PLANET)
love.graphics.circle("fill", 500, 100, 200)
love.graphics.setColor(255,255,255,50)
love.graphics.setColor(COLOR_SPACE)
for i = 1, 40 do
love.graphics.ellipse("line", 500, 125, 300-i, 50-i*1/6 )
end
for _, moon in ipairs(MOONS) do
love.graphics.setColor(moon[4])
love.graphics.setColor(moon.color)
love.graphics.circle("fill",moon[1],moon[2],moon[3])
end
love.graphics.setShader()
@ -55,7 +59,7 @@ SCREENS[1] = function (t)
t = t * 0.1
love.graphics.draw(PLANET)
love.graphics.setColor(255,255,255,255)
love.graphics.setColor(COLOR_WHITE)
love.graphics.circle("fill", 400*(1-t)+t_moon[1]*t, 600*(1-t)+t*t_moon[2], math.min(0, 50*(t-1)))
end

View File

@ -22,10 +22,12 @@ local PLAYER = {
color = {140, 198, 63}
}
local COLOR_WHITE = {255,255,255}
local COLOR_RED = {241, 90, 36}
local COLOR_WHITE = {1,1,1}
local COLOR_RED = {241/255, 90/255, 36/255}
local COLOR_BG = {26/255,26/255,26/255}
local COLOR_GOAL = {41/255, 171/255, 226/255}
local GOAL = {x = 0, y = 0, w = 40, h = 40, color={41, 171, 226}}
local GOAL = {x = 0, y = 0, w = 40, h = 40, color=COLOR_GOAL}
local BLOCKS = {}
@ -101,7 +103,7 @@ local function update_player_pos (player, dt)
end
function love.load ()
love.graphics.setBackgroundColor(26,26,26)
love.graphics.setBackgroundColor(COLOR_BG)
CURRENT_LEVEL = 1
load_level(LEVELS[CURRENT_LEVEL])
end