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:
parent
f17795c911
commit
f68115733e
11 changed files with 106 additions and 34 deletions
BIN
GFX/fonts/CloisterBlackLight-axjg.ttf
Normal file
BIN
GFX/fonts/CloisterBlackLight-axjg.ttf
Normal file
Binary file not shown.
2
GFX/fonts/CloisterBlackLight_info.txt
Normal file
2
GFX/fonts/CloisterBlackLight_info.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
license: Freeware
|
||||
link: https://www.fontspace.com/cloister-black-font-f1997
|
||||
BIN
GFX/fonts/Dearkatienbp-nZeg.ttf
Normal file
BIN
GFX/fonts/Dearkatienbp-nZeg.ttf
Normal file
Binary file not shown.
2
GFX/fonts/Dearkatienbp_info.txt
Normal file
2
GFX/fonts/Dearkatienbp_info.txt
Normal 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
BIN
GFX/fonts/Effexor-AEm.ttf
Normal file
Binary file not shown.
2
GFX/fonts/Effexor_info.txt
Normal file
2
GFX/fonts/Effexor_info.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
license: Freeware
|
||||
link: https://www.fontspace.com/effexor-font-f348
|
||||
BIN
GFX/fonts/ScratchedCarPaint-Kd57.ttf
Normal file
BIN
GFX/fonts/ScratchedCarPaint-Kd57.ttf
Normal file
Binary file not shown.
2
GFX/fonts/ScratchedCarPaint_info.txt
Normal file
2
GFX/fonts/ScratchedCarPaint_info.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
license: Freeware
|
||||
link: https://www.fontspace.com/scratched-car-paint-font-f4670
|
||||
85
main.lua
85
main.lua
|
|
@ -9,7 +9,10 @@ check_space = {}
|
|||
|
||||
function love.load()
|
||||
math.randomseed(os.time())
|
||||
physics = require('physics')
|
||||
Scene = "menu"
|
||||
physics_ini = require('physics')
|
||||
menu_ini = require('menu')
|
||||
menu.load()
|
||||
window = {}
|
||||
NPCs = {}
|
||||
window.x, window.y = love.window.getDesktopDimensions()
|
||||
|
|
@ -31,35 +34,43 @@ function love.load()
|
|||
end
|
||||
|
||||
function love.update(dt)
|
||||
input(player, dt)
|
||||
gravity(player, dt)
|
||||
mouvement(player, dt)
|
||||
for i = 1, #NPCs do
|
||||
gravity(NPCs[i], dt)
|
||||
wander(NPCs[i], dt)
|
||||
mouvement(NPCs[i], dt)
|
||||
if NPCs[i].bools.isInteracting then
|
||||
sayHello(NPCs[i], dt)
|
||||
if Scene == "gameTest" then
|
||||
input(player, dt)
|
||||
gravity(player, dt)
|
||||
mouvement(player, dt)
|
||||
for i = 1, #NPCs do
|
||||
gravity(NPCs[i], dt)
|
||||
wander(NPCs[i], dt)
|
||||
mouvement(NPCs[i], dt)
|
||||
if NPCs[i].bools.isInteracting then
|
||||
sayHello(NPCs[i], dt)
|
||||
end
|
||||
end
|
||||
elseif Scene == "menu" then
|
||||
menu.update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
love.graphics.rectangle("line", player.x, player.y, player.width, player.height)
|
||||
if player.bools.isFacingRight then
|
||||
love.graphics.rectangle("line", player.x+10, player.y-20, 20, 20)
|
||||
else
|
||||
love.graphics.rectangle("line", player.x-10, player.y-20, 20, 20)
|
||||
end
|
||||
for i = 1, #NPCs do
|
||||
love.graphics.rectangle("fill", NPCs[i].x, NPCs[i].y, NPCs[i].width, NPCs[i].height)
|
||||
end
|
||||
for i = 1, #NPCs do
|
||||
if NPCs[i].bools.isInteracting then
|
||||
local font = love.graphics.getFont()
|
||||
local helloText = love.graphics.newText(font, "Hello there")
|
||||
love.graphics.draw(helloText, NPCs[i].x, NPCs[i].y-10)
|
||||
if Scene == "gameTest" then
|
||||
love.graphics.rectangle("line", player.x, player.y, player.width, player.height)
|
||||
if player.bools.isFacingRight then
|
||||
love.graphics.rectangle("line", player.x+10, player.y-20, 20, 20)
|
||||
else
|
||||
love.graphics.rectangle("line", player.x-10, player.y-20, 20, 20)
|
||||
end
|
||||
for i = 1, #NPCs do
|
||||
love.graphics.rectangle("fill", NPCs[i].x, NPCs[i].y, NPCs[i].width, NPCs[i].height)
|
||||
end
|
||||
for i = 1, #NPCs do
|
||||
if NPCs[i].bools.isInteracting then
|
||||
local font = love.graphics.getFont()
|
||||
local helloText = love.graphics.newText(font, "Hello there")
|
||||
love.graphics.draw(helloText, NPCs[i].x, NPCs[i].y-10)
|
||||
end
|
||||
end
|
||||
elseif Scene == "menu" then
|
||||
menu.draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -104,16 +115,22 @@ function love.mousemoved(x, y)
|
|||
end
|
||||
|
||||
function love.keypressed(key)
|
||||
if key == keybind.jump then player.physics.velocityY = player.physics.velocityY - 3 end
|
||||
if key == keybind.interact then
|
||||
check_space.interactables(player.x, player.y)
|
||||
end
|
||||
if key == keybind.create then
|
||||
NPCs[#NPCs+1] = character.create({"attributes", "functions","bools","physics"}, false)
|
||||
NPCs[#NPCs].x = math.random(0, window.x-20)
|
||||
NPCs[#NPCs].y = window.y/2-window.y/20
|
||||
NPCs[#NPCs].width = 20
|
||||
NPCs[#NPCs].height = 80
|
||||
if Scene == "gameTest" then
|
||||
if key == keybind.jump then player.physics.velocityY = player.physics.velocityY - 3 end
|
||||
if key == keybind.interact then
|
||||
check_space.interactables(player.x, player.y)
|
||||
end
|
||||
if key == keybind.create then
|
||||
NPCs[#NPCs+1] = character.create({"attributes", "functions","bools","physics"}, false)
|
||||
NPCs[#NPCs].x = math.random(0, window.x-20)
|
||||
NPCs[#NPCs].y = window.y/2-window.y/20
|
||||
NPCs[#NPCs].width = 20
|
||||
NPCs[#NPCs].height = 80
|
||||
end
|
||||
else
|
||||
if key == keybind.jump then
|
||||
titleCard.duration = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
41
menu.lua
Normal file
41
menu.lua
Normal 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
6
scripts/fonts.lua
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue