World Gen #3, Inventory #2

-- Added item interaction
-- Changed inventory management slightly
-- Added slide-show system to world, world can now "move" to show more space.
This commit is contained in:
Hannah-Dagemark 2023-10-16 08:44:17 +02:00
commit 3a3bea1ead
8 changed files with 164 additions and 22 deletions

View file

@ -13,6 +13,7 @@ function love.load()
window.x, window.y = love.window.getDesktopDimensions()
math.randomseed(os.time())
Scene = "menu"
items_ini = require('scripts/items')
inputs_ini = require('scripts/inputs')
physics_ini = require('physics')
menu_ini = require('menu')
@ -47,6 +48,7 @@ function love.update(dt)
end
keyboard_input_held(player, dt)
gravity(player, dt)
World.mapMovement(player.x)
mouvement(player, dt)
for i = 1, #NPCs do
gravity(NPCs[i], dt)
@ -98,6 +100,10 @@ function love.draw()
end
end
if globalMode == "devMode" then
love.graphics.print("World X " .. World.map.x, 100, 150)
love.graphics.print("X " .. player.x, 100, 200)
love.graphics.print("Y " .. player.y, 100, 250)
love.graphics.print("Velocity X " .. player.physics.velocityX, 100, 300)
love.graphics.print("Velocity Y " .. player.physics.velocityY, 100, 350)
love.graphics.print("Airtime " .. player.physics.airtime, 100, 400)
@ -193,11 +199,11 @@ end
function inventory(mode, slot, item)
if mode == "add" then
hotbar_cont[slot] = item
player.hotbar_cont[slot] = item
elseif mode == "remove" then
hotbar_cont[slot] = nil
player.hotbar_cont[slot] = nil
elseif mode == "move" then
item = hotbar_cont[slot[1]]
hotbar_cont[slot[2]] = item
player.hotbar_cont[slot[2]] = item
end
end