more naming convention
now there are spawn objects! now entity spawns are loaded from level! now entity spawns are saved to level!
This commit is contained in:
parent
a8ffae726f
commit
0acbfd5e9d
@ -10,10 +10,10 @@ LoadedObjects.Rooms = {}
|
|||||||
--[[
|
--[[
|
||||||
Collision
|
Collision
|
||||||
|
|
||||||
[bool flag] isDisabled
|
[bool flag] is_disabled
|
||||||
> if true used for collision
|
> if true used for collision
|
||||||
|
|
||||||
[bool flag] isColliding
|
[bool flag] is_colliding
|
||||||
> if true, this collision is colliding
|
> if true, this collision is colliding
|
||||||
|
|
||||||
[vec2 position] from - x, y
|
[vec2 position] from - x, y
|
||||||
@ -31,7 +31,7 @@ LoadedObjects.Rooms = {}
|
|||||||
|
|
||||||
-- can also be called with only ox and oy, where they become the width and height instead
|
-- can also be called with only ox and oy, where they become the width and height instead
|
||||||
function Collision:new(ox,oy,tx,ty)
|
function Collision:new(ox,oy,tx,ty)
|
||||||
local o = {isColliding = false, isDisabled = false}
|
local o = {is_colliding = false, is_disabled = false}
|
||||||
|
|
||||||
if tx ~= nil and ty ~= nil then
|
if tx ~= nil and ty ~= nil then
|
||||||
o.from = {x = ox, y = oy}
|
o.from = {x = ox, y = oy}
|
||||||
@ -77,7 +77,7 @@ function Collision:containsPoint(x, y)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Collision:draw(color)
|
function Collision:draw(color)
|
||||||
if self.isColliding == true then
|
if self.is_colliding == true then
|
||||||
love.graphics.setColor(0,1,0,0.5)
|
love.graphics.setColor(0,1,0,0.5)
|
||||||
elseif color == 1 then
|
elseif color == 1 then
|
||||||
love.graphics.setColor(1,0,0,0.5)
|
love.graphics.setColor(1,0,0,0.5)
|
||||||
|
@ -21,8 +21,6 @@ function debugUI()
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- player isOnGroundCheck
|
|
||||||
--love.graphics.main_Player
|
|
||||||
love.graphics.setColor(1,0,0)
|
love.graphics.setColor(1,0,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
Arrow = Entity:new()
|
Arrow = Entity:new()
|
||||||
|
Arrow.type = "Arrow"
|
||||||
|
|
||||||
|
|
||||||
function Arrow:new(x,y,rotation,speed)
|
function Arrow:new(x,y,rotation,speed)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "arrow"
|
|
||||||
|
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.speed = speed or 10
|
o.speed = speed or 10
|
||||||
o.sprite_rotation = rotation or 0
|
o.sprite_rotation = rotation or 0
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
CursedBook = Entity:new()
|
CursedBook = Entity:new()
|
||||||
|
CursedBook.type = "CursedBook"
|
||||||
|
|
||||||
function CursedBook:new(x,y)
|
function CursedBook:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "cursed_book"
|
|
||||||
-- behaviour
|
-- behaviour
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.speed = 0.01
|
o.speed = 0.01
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
Decoration = Entity:new()
|
Decoration = Entity:new()
|
||||||
|
Decoration.type = "Decoration"
|
||||||
|
|
||||||
function Decoration:new(x,y,animation,light_radius)
|
function Decoration:new(x,y,animation,light_radius)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "decoration"
|
|
||||||
|
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
|
|
||||||
-- animations
|
-- animations
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
Fairy = Entity:new()
|
Fairy = Entity:new()
|
||||||
|
Fairy.type = "Fairy"
|
||||||
|
|
||||||
function Fairy:new(x,y)
|
function Fairy:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "fairy"
|
|
||||||
|
|
||||||
-- behaviour
|
-- behaviour
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.speed = 1.4
|
o.speed = 1.4
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
HookAnchor = Entity:new()
|
HookAnchor = Entity:new()
|
||||||
|
HookAnchor.type = "HookAnchor"
|
||||||
|
|
||||||
function HookAnchor:new(x,y,hook_distance)
|
function HookAnchor:new(x,y,hook_distance)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "hook_anchor"
|
|
||||||
|
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.hook_distance = hook_distance or 100
|
o.hook_distance = hook_distance or 100
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
Kupo = Entity:new()
|
Kupo = Entity:new()
|
||||||
|
Kupo.type = "Kupo"
|
||||||
|
|
||||||
function Kupo:new(x,y)
|
function Kupo:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "kupo"
|
|
||||||
|
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.speed = 20
|
o.speed = 20
|
||||||
o.range = 200
|
o.range = 200
|
||||||
@ -142,7 +141,7 @@ function Kupo:handleAnimation()
|
|||||||
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
||||||
|
|
||||||
self.body:animate()
|
self.body:animate()
|
||||||
self:Draw(self.body)
|
self:draw(self.body)
|
||||||
|
|
||||||
if self.draw_bow == true then
|
if self.draw_bow == true then
|
||||||
self.bow:drawFrame(
|
self.bow:drawFrame(
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Particle = Entity:new()
|
|
||||||
LoadedObjects.Particles = {}
|
LoadedObjects.Particles = {}
|
||||||
|
|
||||||
|
Particle = Entity:new()
|
||||||
|
Particle.type = "Particle"
|
||||||
|
|
||||||
function Particle:new(x,y,particle_data)
|
function Particle:new(x,y,particle_data)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Player = Entity:new()
|
Player = Entity:new()
|
||||||
|
Player.type = "Player"
|
||||||
|
|
||||||
function Player:new(x,y)
|
function Player:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
|
|
||||||
o.type = "player"
|
|
||||||
-- physics
|
-- physics
|
||||||
o.zero_speed = 0.01 -- gameworld pixels
|
o.zero_speed = 0.01 -- gameworld pixels
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ function Player:doLogic()
|
|||||||
if self.is_hooked then
|
if self.is_hooked then
|
||||||
self:unhook()
|
self:unhook()
|
||||||
else
|
else
|
||||||
local anchor = self:checkNearest("hook_anchor",self.hook_distance)
|
local anchor = self:checkNearest("HookAnchor",self.hook_distance)
|
||||||
if anchor then
|
if anchor then
|
||||||
self.is_hooked = true
|
self.is_hooked = true
|
||||||
self.hook_distance = anchor.hook_distance
|
self.hook_distance = anchor.hook_distance
|
||||||
|
@ -179,7 +179,7 @@ function Entity:getCollidingAt(x,y,object)
|
|||||||
and y + self.box.from.y < collision.to.y
|
and y + self.box.from.y < collision.to.y
|
||||||
and y + self.box.to.y > collision.from.y
|
and y + self.box.to.y > collision.from.y
|
||||||
then
|
then
|
||||||
collision.isColliding = true
|
collision.is_colliding = true
|
||||||
return collision
|
return collision
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -39,9 +39,9 @@ function stepGame()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.debug.reload) then
|
if Keybind:checkPressed(Keybind.debug.reload) then
|
||||||
MenuClear()
|
clearMenu()
|
||||||
menu_type = "dialog"
|
menu_type = "dialog"
|
||||||
MenuInit("dialog",DialogSequence.Example)
|
initMenu("dialog",dialog_sequence.example)
|
||||||
end
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.debug.editor) then
|
if Keybind:checkPressed(Keybind.debug.editor) then
|
||||||
|
@ -46,6 +46,24 @@ function exportLevel(levelname, filename)
|
|||||||
exportFile:write("\n },")
|
exportFile:write("\n },")
|
||||||
logPrint("- objects")
|
logPrint("- objects")
|
||||||
exportFile:write("\n objects = {")
|
exportFile:write("\n objects = {")
|
||||||
|
logPrint(" - spawns")
|
||||||
|
exportFile:write("\n spawns = {")
|
||||||
|
for i, v in ipairs(LoadedObjects.Spawns) do
|
||||||
|
if i > 1 then
|
||||||
|
exportFile:write(",")
|
||||||
|
end
|
||||||
|
exportFile:write("\n {")
|
||||||
|
exportFile:write(v.archetype.type)
|
||||||
|
exportFile:write(",{")
|
||||||
|
for i=1, #v.args do
|
||||||
|
if i > 1 then
|
||||||
|
exportFile:write(",")
|
||||||
|
end
|
||||||
|
exportFile:write(v.args[i])
|
||||||
|
end
|
||||||
|
exportFile:write("}}")
|
||||||
|
end
|
||||||
|
exportFile:write("\n },")
|
||||||
logPrint(" - rooms")
|
logPrint(" - rooms")
|
||||||
exportFile:write("\n rooms = {")
|
exportFile:write("\n rooms = {")
|
||||||
for i, room in ipairs(LoadedObjects.Rooms) do
|
for i, room in ipairs(LoadedObjects.Rooms) do
|
||||||
@ -82,22 +100,6 @@ function scandir(directory)
|
|||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
return {
|
|
||||||
name = "level1",
|
|
||||||
tileset = tileset.library,
|
|
||||||
tiles = {
|
|
||||||
{13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13},
|
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 0, 0, 0, 0, 0, 0, 5,25,26, 6,25,26, 7, 0, 5,25,26, 7, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 0, 0, 0, 0, 0, 0, 5,37,38, 6,37,38, 7, 0, 5,37,38, 7, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 0, 0, 0, 0, 0, 0, 5,37,38, 6,37,38, 7, 0, 5,37,38, 7, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 0, 0, 0, 0, 0, 0, 5,49,50, 6,49,50, 7, 0, 5,49,50, 7, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
|
||||||
},
|
|
||||||
objects = {}
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
if logging then
|
if logging then
|
||||||
-- Make log stuff
|
-- Make log stuff
|
||||||
os.execute( "mkdir \"./logs\"" )
|
os.execute( "mkdir \"./logs\"" )
|
||||||
|
@ -110,6 +110,7 @@ function Keybind:default()
|
|||||||
Keybind.debug.editor = { keys = {"f4"}}
|
Keybind.debug.editor = { keys = {"f4"}}
|
||||||
Keybind.debug.recording = { keys = {"f5"}}
|
Keybind.debug.recording = { keys = {"f5"}}
|
||||||
Keybind.debug.playback = { keys = {"f6"}}
|
Keybind.debug.playback = { keys = {"f6"}}
|
||||||
|
Keybind.debug.respawn = { keys = {"f8"}}
|
||||||
|
|
||||||
-- Editor
|
-- Editor
|
||||||
Keybind.editor.palette_mode = { keys = {"tab"}}
|
Keybind.editor.palette_mode = { keys = {"tab"}}
|
||||||
|
@ -18,14 +18,23 @@ function loadLevelTiles()
|
|||||||
indexLevelTiles()
|
indexLevelTiles()
|
||||||
createTileObjects()
|
createTileObjects()
|
||||||
createRoomObjects()
|
createRoomObjects()
|
||||||
|
getSpawns()
|
||||||
end
|
end
|
||||||
|
|
||||||
function createRoomObjects()
|
function createRoomObjects()
|
||||||
|
LoadedObjects.Rooms = {}
|
||||||
for _, v in pairs(LevelData.objects.rooms) do
|
for _, v in pairs(LevelData.objects.rooms) do
|
||||||
table.insert(LoadedObjects.Rooms, Collision:new(v[1][1],v[1][2],v[2][1],v[2][2]))
|
table.insert(LoadedObjects.Rooms, Collision:new(v[1][1],v[1][2],v[2][1],v[2][2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getSpawns()
|
||||||
|
LoadedObjects.Spawns = {}
|
||||||
|
for _, v in pairs(LevelData.objects.spawns) do
|
||||||
|
addSpawn(v[1],unpack(v[2]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function expandLevelCanvas(horizontal,vertical)
|
function expandLevelCanvas(horizontal,vertical)
|
||||||
local horizontal = horizontal or 0
|
local horizontal = horizontal or 0
|
||||||
local vertical = vertical or 0
|
local vertical = vertical or 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
function drawMenu(menu)
|
function drawMenu(menu)
|
||||||
local font = love.graphics.getFont()
|
local font = love.graphics.getFont()
|
||||||
love.graphics.setFont(LocaleFont)
|
love.graphics.setFont(locale_font)
|
||||||
|
|
||||||
-- reset scale
|
-- reset scale
|
||||||
love.graphics.setScale()
|
love.graphics.setScale()
|
||||||
@ -54,19 +54,19 @@ function stepMenu(menu)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function stepMenuPauseScreen()
|
function stepMenuPauseScreen()
|
||||||
if PauseResume:getVariable() == true then
|
if pause_resume:getVariable() == true then
|
||||||
PauseResume = nil
|
pause_resume = nil
|
||||||
PauseOptions = nil
|
pause_options = nil
|
||||||
PauseExit = nil
|
pause_exit = nil
|
||||||
exitMenu()
|
exitMenu()
|
||||||
elseif PauseExit:getVariable() == true then
|
elseif pause_exit:getVariable() == true then
|
||||||
love.event.quit()
|
love.event.quit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function stepMenuDialog()
|
function stepMenuDialog()
|
||||||
if DialogContainer.value >= DialogContainer.target_value then
|
if dialog_container.value >= dialog_container.target_value then
|
||||||
DialogContainer = nil
|
dialog_container = nil
|
||||||
exitMenu()
|
exitMenu()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -90,55 +90,55 @@ function initMenu(menu,parameter)
|
|||||||
initMenuPauseScreen()
|
initMenuPauseScreen()
|
||||||
elseif menu == "dialog" then
|
elseif menu == "dialog" then
|
||||||
if parameter == nil then
|
if parameter == nil then
|
||||||
parameter = DialogSequence.Example
|
parameter = dialog_sequence.Example
|
||||||
end
|
end
|
||||||
initMenuDialog(parameter)
|
initMenuDialog(parameter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function initMenuDialog(parameter)
|
function initMenuDialog(parameter)
|
||||||
DialogContainer = interfaceDialog:new()
|
dialog_container = InterfaceDialog:new()
|
||||||
DialogContainer:loadSequence(parameter)
|
dialog_container:loadSequence(parameter)
|
||||||
end
|
end
|
||||||
|
|
||||||
function initMenuPauseScreen()
|
function initMenuPauseScreen()
|
||||||
local buttonStandard = {width = 200, height = 30, separation = 10}
|
local button_standard = {width = 200, height = 30, separation = 10}
|
||||||
-- elements
|
-- elements
|
||||||
PauseResume = InterfaceButton:new(
|
pause_resume = InterfaceButton:new(
|
||||||
game.width/2,
|
game.width/2,
|
||||||
game.height/2-buttonStandard.height-buttonStandard.separation,
|
game.height/2-button_standard.height-button_standard.separation,
|
||||||
buttonStandard.width,
|
button_standard.width,
|
||||||
buttonStandard.height,
|
button_standard.height,
|
||||||
{false,true},
|
{false,true},
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
text = Locale.ui.pause_screen_resume,
|
text = locale.ui.pause_screen_resume,
|
||||||
color = {0,0,0.5},
|
color = {0,0,0.5},
|
||||||
color2 = {1,1,1}
|
color2 = {1,1,1}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
PauseOptions = InterfaceButton:new(
|
pause_options = InterfaceButton:new(
|
||||||
game.width/2,
|
game.width/2,
|
||||||
game.height/2,
|
game.height/2,
|
||||||
buttonStandard.width,
|
button_standard.width,
|
||||||
buttonStandard.height,
|
button_standard.height,
|
||||||
{false,true},
|
{false,true},
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
text = Locale.ui.pause_screen_options,
|
text = locale.ui.pause_screen_options,
|
||||||
color = {0,0,0.5},
|
color = {0,0,0.5},
|
||||||
color2 = {1,1,1}
|
color2 = {1,1,1}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
PauseExit = InterfaceButton:new(
|
pause_exit = InterfaceButton:new(
|
||||||
game.width/2,
|
game.width/2,
|
||||||
game.height/2+buttonStandard.height+buttonStandard.separation,
|
game.height/2+button_standard.height+button_standard.separation,
|
||||||
buttonStandard.width,
|
button_standard.width,
|
||||||
buttonStandard.height,
|
button_standard.height,
|
||||||
{false,true},
|
{false,true},
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
text = Locale.ui.pause_screen_exit,
|
text = locale.ui.pause_screen_exit,
|
||||||
color = {0,0,0.5},
|
color = {0,0,0.5},
|
||||||
color2 = {1,1,1}
|
color2 = {1,1,1}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ function LoadedObjects.drawCollisions()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, platform in pairs(LoadedObjects.Platforms) do
|
for _, platform in pairs(LoadedObjects.Platforms) do
|
||||||
if platform.disable == true then platform:Draw(2) end
|
if platform.is_disabled == true then platform:Draw(2) end
|
||||||
if platform.disable == false then platform:Draw(1) end
|
if platform.is_disabled == false then platform:Draw(1) end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, ladder in pairs(LoadedObjects.Ladders) do
|
for _, ladder in pairs(LoadedObjects.Ladders) do
|
||||||
@ -23,13 +23,13 @@ end
|
|||||||
-- returns true if theres a collision at that point
|
-- returns true if theres a collision at that point
|
||||||
function isThereObjectAt(x,y,objectType)
|
function isThereObjectAt(x,y,objectType)
|
||||||
for _, object in pairs(objectType) do
|
for _, object in pairs(objectType) do
|
||||||
if object.disable then
|
if object.is_disabled then
|
||||||
-- Dont calculate if dissabled
|
-- Dont calculate if dissabled
|
||||||
elseif x >= object.from.x
|
elseif x >= object.from.x
|
||||||
and x <= object.to.x
|
and x <= object.to.x
|
||||||
and y >= object.from.y
|
and y >= object.from.y
|
||||||
and y <= object.to.y then
|
and y <= object.to.y then
|
||||||
object.isColliding = true
|
object.is_colliding = true
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -54,21 +54,21 @@ function setCollisionFlags()
|
|||||||
}
|
}
|
||||||
for _, type in pairs(Check) do
|
for _, type in pairs(Check) do
|
||||||
for _, object in pairs(type) do
|
for _, object in pairs(type) do
|
||||||
object.isColliding = false
|
object.is_colliding = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, platform in pairs(LoadedObjects.Platforms) do
|
for _, platform in pairs(LoadedObjects.Platforms) do
|
||||||
if main_Player.pos.y < platform.from.y then
|
if main_player.pos.y < platform.from.y then
|
||||||
platform.disable = false
|
platform.is_disabled = false
|
||||||
else
|
else
|
||||||
platform.disable = true
|
platform.is_disabled = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, platform in pairs(LoadedObjects.Hazards) do
|
for _, platform in pairs(LoadedObjects.Hazards) do
|
||||||
if main_Player.isOnGround then
|
if main_player.isOnGround then
|
||||||
platform.disable = true
|
platform.is_disabled = true
|
||||||
else
|
else
|
||||||
platform.disable = false
|
platform.is_disabled = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -22,6 +22,7 @@ require "code/queue"
|
|||||||
|
|
||||||
-- objects
|
-- objects
|
||||||
require "code/entity"
|
require "code/entity"
|
||||||
|
require "code/spawn"
|
||||||
require "code/canvas"
|
require "code/canvas"
|
||||||
require "code/collision"
|
require "code/collision"
|
||||||
require "code/lights"
|
require "code/lights"
|
||||||
|
15
code/spawn.lua
Normal file
15
code/spawn.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
LoadedObjects.Spawns = {}
|
||||||
|
|
||||||
|
function addSpawn(archetype, ...)
|
||||||
|
local o = {
|
||||||
|
archetype = archetype,
|
||||||
|
args = {...}
|
||||||
|
}
|
||||||
|
table.insert(LoadedObjects.Spawns, o)
|
||||||
|
end
|
||||||
|
|
||||||
|
function activateSpawns()
|
||||||
|
for _, spawn in pairs(LoadedObjects.Spawns) do
|
||||||
|
spawn.archetype:new(unpack(spawn.args))
|
||||||
|
end
|
||||||
|
end
|
@ -1,7 +1,7 @@
|
|||||||
dialog_sequence = {}
|
dialog_sequence = {}
|
||||||
|
|
||||||
dialog_sequence.Example = {
|
dialog_sequence.example = {
|
||||||
{Locale.dialogue.example[1],Locale.name.fairy},
|
{locale.dialogue.example[1],locale.name.fairy},
|
||||||
{Locale.dialogue.example[2],Locale.name.chaos},
|
{locale.dialogue.example[2],locale.name.chaos},
|
||||||
{Locale.dialogue.example[3],Locale.name.life}
|
{locale.dialogue.example[3],locale.name.life}
|
||||||
}
|
}
|
||||||
|
@ -2,38 +2,41 @@ return {
|
|||||||
name = "unnamed",
|
name = "unnamed",
|
||||||
tileset = tileset.library,
|
tileset = tileset.library,
|
||||||
properties = {
|
properties = {
|
||||||
darkness = true
|
darkness = false
|
||||||
},
|
},
|
||||||
tiles = {
|
tiles = {
|
||||||
{ 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
{ 1, 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
{ 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
{ 1, 4, 0, 0, 0, 2, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
{ 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
||||||
},
|
},
|
||||||
objects = {
|
objects = {
|
||||||
|
spawns = {
|
||||||
|
{Fairy,{100,88}},
|
||||||
|
{HookAnchor,{200,89,100}},
|
||||||
|
{HookAnchor,{400,89,120}}
|
||||||
|
},
|
||||||
rooms = {
|
rooms = {
|
||||||
{{16,0},{128,208}},
|
{{96,64},{544,320}},
|
||||||
{{96,128},{272,240}},
|
{{0,0},{112,176}}
|
||||||
{{224,80},{336,192}},
|
},
|
||||||
{{400,32},{560,352}}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
LocaleFont = love.graphics.getFont()
|
locale_font = love.graphics.getFont()
|
||||||
|
|
||||||
Locale = {}
|
locale = {}
|
||||||
|
|
||||||
Locale.ui = {}
|
locale.ui = {}
|
||||||
Locale.ui.pause_screen_resume = "Resume"
|
locale.ui.pause_screen_resume = "Resume"
|
||||||
Locale.ui.pause_screen_options = "Options"
|
locale.ui.pause_screen_options = "Options"
|
||||||
Locale.ui.pause_screen_exit = "Exit"
|
locale.ui.pause_screen_exit = "Exit"
|
||||||
|
|
||||||
Locale.name = {}
|
locale.name = {}
|
||||||
Locale.name.fairy = "Ozy"
|
locale.name.fairy = "Ozy"
|
||||||
Locale.name.chaos = "Aelato"
|
locale.name.chaos = "Aelato"
|
||||||
Locale.name.life = "Olidia"
|
locale.name.life = "Olidia"
|
||||||
|
|
||||||
Locale.dialogue = {}
|
locale.dialogue = {}
|
||||||
Locale.dialogue.example = {"Hello!","Duh.","Lol"}
|
locale.dialogue.example = {"Hello!","Duh.","Lol"}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
LocaleFont = love.graphics.newFont("assets/ui/fonts/heon.ttf",18)
|
locale_font = love.graphics.newFont("assets/ui/fonts/heon.ttf",18)
|
||||||
|
|
||||||
Locale = {}
|
locale = {}
|
||||||
|
|
||||||
Locale.ui = {}
|
locale.ui = {}
|
||||||
Locale.ui.pause_screen_resume = ""
|
locale.ui.pause_screen_resume = ""
|
||||||
Locale.ui.pause_screen_options = ""
|
locale.ui.pause_screen_options = ""
|
||||||
Locale.ui.pause_screen_exit = ""
|
locale.ui.pause_screen_exit = ""
|
||||||
|
|
||||||
Locale.name = {}
|
locale.name = {}
|
||||||
Locale.name.fairy = ""
|
locale.name.fairy = ""
|
||||||
Locale.name.chaos = ""
|
locale.name.chaos = ""
|
||||||
Locale.name.life = ""
|
locale.name.life = ""
|
||||||
|
|
||||||
Locale.dialogue = {}
|
locale.dialogue = {}
|
||||||
Locale.dialogue.example = {"","",""}
|
locale.dialogue.example = {"","",""}
|
||||||
|
12
main.lua
12
main.lua
@ -53,13 +53,7 @@ function love.load()
|
|||||||
|
|
||||||
main_player = Player:new(75,50)
|
main_player = Player:new(75,50)
|
||||||
|
|
||||||
--Kupo:new(100,150)
|
activateSpawns()
|
||||||
--Kupo:new(300,150)
|
|
||||||
HookAnchor:new(200,89)
|
|
||||||
HookAnchor:new(400,89)
|
|
||||||
Fairy:new(200,88)
|
|
||||||
--CursedBook:new(180,68)
|
|
||||||
|
|
||||||
--love.audio.play(music.placeholder)
|
--love.audio.play(music.placeholder)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -109,6 +103,10 @@ function love.update(dt)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Keybind:checkPressed(Keybind.debug.respawn) then
|
||||||
|
activateSpawns()
|
||||||
|
end
|
||||||
|
|
||||||
if love.keyboard.isDown("f7") then
|
if love.keyboard.isDown("f7") then
|
||||||
local test_prompt = Prompt:new({
|
local test_prompt = Prompt:new({
|
||||||
name = "test prompt",
|
name = "test prompt",
|
||||||
|
Loading…
Reference in New Issue
Block a user