diff --git a/GFX/fonts/CloisterBlackLight-axjg.ttf b/GFX/fonts/CloisterBlackLight-axjg.ttf new file mode 100644 index 0000000..2216b84 Binary files /dev/null and b/GFX/fonts/CloisterBlackLight-axjg.ttf differ diff --git a/GFX/fonts/CloisterBlackLight_info.txt b/GFX/fonts/CloisterBlackLight_info.txt new file mode 100644 index 0000000..8042210 --- /dev/null +++ b/GFX/fonts/CloisterBlackLight_info.txt @@ -0,0 +1,2 @@ +license: Freeware +link: https://www.fontspace.com/cloister-black-font-f1997 \ No newline at end of file diff --git a/GFX/fonts/Dearkatienbp-nZeg.ttf b/GFX/fonts/Dearkatienbp-nZeg.ttf new file mode 100644 index 0000000..69aa4df Binary files /dev/null and b/GFX/fonts/Dearkatienbp-nZeg.ttf differ diff --git a/GFX/fonts/Dearkatienbp_info.txt b/GFX/fonts/Dearkatienbp_info.txt new file mode 100644 index 0000000..48ec06d --- /dev/null +++ b/GFX/fonts/Dearkatienbp_info.txt @@ -0,0 +1,2 @@ +license: Creative Commons (by-sa) Attribution Share Alike +link: https://www.fontspace.com/dearkatienbp-font-f15236 \ No newline at end of file diff --git a/GFX/fonts/Effexor-AEm.ttf b/GFX/fonts/Effexor-AEm.ttf new file mode 100644 index 0000000..c0b060d Binary files /dev/null and b/GFX/fonts/Effexor-AEm.ttf differ diff --git a/GFX/fonts/Effexor_info.txt b/GFX/fonts/Effexor_info.txt new file mode 100644 index 0000000..970f15a --- /dev/null +++ b/GFX/fonts/Effexor_info.txt @@ -0,0 +1,2 @@ +license: Freeware +link: https://www.fontspace.com/effexor-font-f348 \ No newline at end of file diff --git a/GFX/fonts/ScratchedCarPaint-Kd57.ttf b/GFX/fonts/ScratchedCarPaint-Kd57.ttf new file mode 100644 index 0000000..233f65f Binary files /dev/null and b/GFX/fonts/ScratchedCarPaint-Kd57.ttf differ diff --git a/GFX/fonts/ScratchedCarPaint_info.txt b/GFX/fonts/ScratchedCarPaint_info.txt new file mode 100644 index 0000000..3060e89 --- /dev/null +++ b/GFX/fonts/ScratchedCarPaint_info.txt @@ -0,0 +1,2 @@ +license: Freeware +link: https://www.fontspace.com/scratched-car-paint-font-f4670 \ No newline at end of file diff --git a/main.lua b/main.lua index b655739..ee8bf3c 100644 --- a/main.lua +++ b/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 diff --git a/menu.lua b/menu.lua new file mode 100644 index 0000000..5add5e9 --- /dev/null +++ b/menu.lua @@ -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 \ No newline at end of file diff --git a/scripts/fonts.lua b/scripts/fonts.lua new file mode 100644 index 0000000..0c062d3 --- /dev/null +++ b/scripts/fonts.lua @@ -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) \ No newline at end of file