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

@ -40,7 +40,18 @@ function love.keypressed(key)
if Scene == "gameTest" then
if key == keybinds.jump and player.bools.isAirborne == false then player.physics.velocityY = player.physics.velocityY - 5 end
if key == keybinds.interact then
check_space.interactables(player.x, player.y)
if checkSpace.items(player.x, player.y) then
local id = checkSpace.items(player.x, player.y)
print("Found Item near player")
local newItem = itemgen.createFromWorld(id)
inventory("add", player.current_equip, newItem)
print("Added item " .. World.map.items[id][1])
removeFromWorld("items", id)
elseif checkSpace.interactables(player.x, player.y) then
print("Interacted with smthn")
else
print("Attempted to interact, found nothing")
end
end
if key == keybinds.create then
NPCs[#NPCs+1] = character.create({"attributes", "functions","bools","physics"}, false)