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:
lustlion
2022-03-08 09:34:51 +01:00
parent a8ffae726f
commit 0acbfd5e9d
24 changed files with 165 additions and 139 deletions

View File

@@ -7,8 +7,8 @@ function LoadedObjects.drawCollisions()
end
for _, platform in pairs(LoadedObjects.Platforms) do
if platform.disable == true then platform:Draw(2) end
if platform.disable == false then platform:Draw(1) end
if platform.is_disabled == true then platform:Draw(2) end
if platform.is_disabled == false then platform:Draw(1) end
end
for _, ladder in pairs(LoadedObjects.Ladders) do
@@ -23,13 +23,13 @@ end
-- returns true if theres a collision at that point
function isThereObjectAt(x,y,objectType)
for _, object in pairs(objectType) do
if object.disable then
if object.is_disabled then
-- Dont calculate if dissabled
elseif x >= object.from.x
and x <= object.to.x
and y >= object.from.y
and y <= object.to.y then
object.isColliding = true
object.is_colliding = true
return true
end
end
@@ -54,21 +54,21 @@ function setCollisionFlags()
}
for _, type in pairs(Check) do
for _, object in pairs(type) do
object.isColliding = false
object.is_colliding = false
end
end
for _, platform in pairs(LoadedObjects.Platforms) do
if main_Player.pos.y < platform.from.y then
platform.disable = false
if main_player.pos.y < platform.from.y then
platform.is_disabled = false
else
platform.disable = true
platform.is_disabled = true
end
end
for _, platform in pairs(LoadedObjects.Hazards) do
if main_Player.isOnGround then
platform.disable = true
if main_player.isOnGround then
platform.is_disabled = true
else
platform.disable = false
platform.is_disabled = false
end
end
end