Fonts and Menu

Added a font library and four fonts
Added Scene configuration
Added a Menu scene
Added intro text to menu (+ FADE!!!!!!)
This commit is contained in:
Zaponium 2023-08-31 20:48:42 +02:00
commit f68115733e
11 changed files with 106 additions and 34 deletions

Binary file not shown.

View file

@ -0,0 +1,2 @@
license: Freeware
link: https://www.fontspace.com/cloister-black-font-f1997

Binary file not shown.

View file

@ -0,0 +1,2 @@
license: Creative Commons (by-sa) Attribution Share Alike
link: https://www.fontspace.com/dearkatienbp-font-f15236

BIN
GFX/fonts/Effexor-AEm.ttf Normal file

Binary file not shown.

View file

@ -0,0 +1,2 @@
license: Freeware
link: https://www.fontspace.com/effexor-font-f348

Binary file not shown.

View file

@ -0,0 +1,2 @@
license: Freeware
link: https://www.fontspace.com/scratched-car-paint-font-f4670

View file

@ -9,7 +9,10 @@ check_space = {}
function love.load() function love.load()
math.randomseed(os.time()) math.randomseed(os.time())
physics = require('physics') Scene = "menu"
physics_ini = require('physics')
menu_ini = require('menu')
menu.load()
window = {} window = {}
NPCs = {} NPCs = {}
window.x, window.y = love.window.getDesktopDimensions() window.x, window.y = love.window.getDesktopDimensions()
@ -31,6 +34,7 @@ function love.load()
end end
function love.update(dt) function love.update(dt)
if Scene == "gameTest" then
input(player, dt) input(player, dt)
gravity(player, dt) gravity(player, dt)
mouvement(player, dt) mouvement(player, dt)
@ -42,9 +46,13 @@ function love.update(dt)
sayHello(NPCs[i], dt) sayHello(NPCs[i], dt)
end end
end end
elseif Scene == "menu" then
menu.update(dt)
end
end end
function love.draw() function love.draw()
if Scene == "gameTest" then
love.graphics.rectangle("line", player.x, player.y, player.width, player.height) love.graphics.rectangle("line", player.x, player.y, player.width, player.height)
if player.bools.isFacingRight then if player.bools.isFacingRight then
love.graphics.rectangle("line", player.x+10, player.y-20, 20, 20) love.graphics.rectangle("line", player.x+10, player.y-20, 20, 20)
@ -61,6 +69,9 @@ function love.draw()
love.graphics.draw(helloText, NPCs[i].x, NPCs[i].y-10) love.graphics.draw(helloText, NPCs[i].x, NPCs[i].y-10)
end end
end end
elseif Scene == "menu" then
menu.draw()
end
end end
@ -104,6 +115,7 @@ function love.mousemoved(x, y)
end end
function love.keypressed(key) function love.keypressed(key)
if Scene == "gameTest" then
if key == keybind.jump then player.physics.velocityY = player.physics.velocityY - 3 end if key == keybind.jump then player.physics.velocityY = player.physics.velocityY - 3 end
if key == keybind.interact then if key == keybind.interact then
check_space.interactables(player.x, player.y) check_space.interactables(player.x, player.y)
@ -115,6 +127,11 @@ function love.keypressed(key)
NPCs[#NPCs].width = 20 NPCs[#NPCs].width = 20
NPCs[#NPCs].height = 80 NPCs[#NPCs].height = 80
end end
else
if key == keybind.jump then
titleCard.duration = true
end
end
end end
function sayHello(object, dt) function sayHello(object, dt)

41
menu.lua Normal file
View file

@ -0,0 +1,41 @@
menu = {}
font_ini = require('scripts/fonts')
function menu.load()
RGB = 1
titleCard = {
duration = false,
mainTitle = {
text = love.graphics.newText(Effexor_Intro, "Void Shot"),
y = 250,
fallingRate = 2
},
secondTitle = {
text = love.graphics.newText(ScratchedCarPaint_Intro, "Endless Desert"),
y = 500,
fallingRate = 2
},
targetTime = 1,
elapsedTime = 0
}
end
function menu.update(dt)
if titleCard.duration == true then
titleCardUpdate(dt)
end
end
function menu.draw()
love.graphics.setColor(RGB, RGB, RGB)
love.graphics.draw(titleCard.mainTitle.text, window.x/2 - titleCard.mainTitle.text:getDimensions()/2, titleCard.mainTitle.y)
love.graphics.draw(titleCard.secondTitle.text, window.x/2 - titleCard.secondTitle.text:getDimensions()*0.5/2, titleCard.secondTitle.y, 0, 0.5, 0.65)
end
function titleCardUpdate(dt)
if RGB > 0.001 then
titleCard.elapsedTime = titleCard.elapsedTime + dt
RGB = 1 - (titleCard.elapsedTime/titleCard.targetTime)
print(RGB)
end
print("Elapsed:" .. titleCard.elapsedTime)
end

6
scripts/fonts.lua Normal file
View file

@ -0,0 +1,6 @@
CloisterBlackLight = love.graphics.newFont("GFX/fonts/CloisterBlackLight-axjg.ttf", 20)
Dearkatie = love.graphics.newFont("GFX/fonts/Dearkatienbp-nZeg.ttf", 20)
Effexor_Intro = love.graphics.newFont("GFX/fonts/Effexor-AEm.ttf", 250)
Effexor_menu = love.graphics.newFont("GFX/fonts/Effexor-AEm.ttf", 100)
ScratchedCarPaint_Intro = love.graphics.newFont("GFX/fonts/ScratchedCarPaint-Kd57.ttf", 100)
ScratchedCarPaint = love.graphics.newFont("GFX/fonts/ScratchedCarPaint-Kd57.ttf", 50)