consistent naming; moving functions from level.lua to gameworld.lua

This commit is contained in:
lustlion
2022-01-22 23:10:21 +01:00
parent f4b44dc7bc
commit 90ed1f6460
13 changed files with 381 additions and 202 deletions

View File

@@ -41,7 +41,7 @@ function Arrow:DoPhysics()
while not isThereObjectAt(
self.pos.x + math.sign(self.vel.x),
self.pos.y,
objects.collisions
LoadedObjects.Collisions
) do
self.pos.x = self.pos.x + math.sign(self.vel.x)
end
@@ -57,7 +57,7 @@ function Arrow:DoPhysics()
while not isThereObjectAt(
self.pos.x,
self.pos.y + math.sign(self.vel.y),
objects.collisions
LoadedObjects.Collisions
) do
self.pos.y = self.pos.y + math.sign(self.vel.y)
end

View File

@@ -66,10 +66,5 @@ function Fairy:DoPhysics()
self.vel.x = self.vel.x + random_x
self.vel.y = self.vel.y + random_y
-- move
if not self:isCollidingAt(self.pos.x + self.vel.x, self.pos.y, objects.collisions) then
self.pos.x = self.pos.x + self.vel.x
end
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, objects.collisions) then
self.pos.y = self.pos.y + self.vel.y
end
self:CollisionMove()
end

View File

@@ -73,10 +73,5 @@ function Particle:HandleAnimation()
end
function Particle:DoPhysics()
if not self:isCollidingAt(self.pos.x + self.vel.x, self.pos.y, objects.collisions) then
self.pos.x = self.pos.x + self.vel.x
end
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, objects.collisions) then
self.pos.y = self.pos.y + self.vel.y
end
self:Move()
end

View File

@@ -144,13 +144,13 @@ function Player:DoPhysics()
self.vel.y = self.vel.y + gravity
end
if not self:isCollidingAt(self.pos.x + self.vel.x + self.move_x, self.pos.y, objects.collisions) then
if not self:isCollidingAt(self.pos.x + self.vel.x + self.move_x, self.pos.y, LoadedObjects.Collisions) then
self.pos.x = self.pos.x + self.vel.x + self.move_x
else
self.vel.x = 0
end
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, objects.collisions) then
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, LoadedObjects.Collisions) then
self.pos.y = self.pos.y + self.vel.y
else
if self.vel.y > 0 then