Level: don't do the roll-around hack for non-physics entnties
This commit is contained in:
parent
bcaaa10056
commit
bb08eb7832
1 changed files with 8 additions and 7 deletions
15
level.lua
15
level.lua
|
@ -1,6 +1,7 @@
|
||||||
Class = require 'hump.class'
|
Class = require 'hump.class'
|
||||||
require 'entities/rectangle'
|
require 'entities/rectangle'
|
||||||
require 'entities/plane'
|
require 'entities/plane'
|
||||||
|
require 'entities/physicsentity'
|
||||||
require 'settings'
|
require 'settings'
|
||||||
|
|
||||||
-- A level manages the level datastructure containing static blocks and level
|
-- A level manages the level datastructure containing static blocks and level
|
||||||
|
@ -61,14 +62,14 @@ Level = Class{
|
||||||
self.world:update(dt)
|
self.world:update(dt)
|
||||||
|
|
||||||
for key, entity in pairs(self.entity_list) do
|
for key, entity in pairs(self.entity_list) do
|
||||||
|
if entity:isinstance(PhysicsEntity) then
|
||||||
while entity.body:getX() > love.window.getWidth() + 200 do
|
while entity.body:getX() > love.window.getWidth() + 200 do
|
||||||
entity.body:setX(entity.body:getX() - love.window.getWidth() - 300)
|
entity.body:setX(entity.body:getX() - love.window.getWidth() - 300)
|
||||||
|
end
|
||||||
|
while entity.body:getX() < -200 do
|
||||||
|
entity.body:setX(entity.body:getX() + love.window.getWidth() + 300)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
while entity.body:getX() < -200 do
|
|
||||||
entity.body:setX(entity.body:getX() + love.window.getWidth() + 300)
|
|
||||||
end
|
|
||||||
|
|
||||||
entity:update(dt)
|
entity:update(dt)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in a new issue