Level: don't do the roll-around hack for non-physics entnties

This commit is contained in:
Erkki Seppälä 2014-10-19 03:27:25 +03:00
parent bcaaa10056
commit bb08eb7832

View file

@ -1,6 +1,7 @@
Class = require 'hump.class'
require 'entities/rectangle'
require 'entities/plane'
require 'entities/physicsentity'
require 'settings'
-- A level manages the level datastructure containing static blocks and level
@ -61,14 +62,14 @@ Level = Class{
self.world:update(dt)
for key, entity in pairs(self.entity_list) do
while entity.body:getX() > love.window.getWidth() + 200 do
entity.body:setX(entity.body:getX() - love.window.getWidth() - 300)
if entity:isinstance(PhysicsEntity) then
while entity.body:getX() > love.window.getWidth() + 200 do
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
while entity.body:getX() < -200 do
entity.body:setX(entity.body:getX() + love.window.getWidth() + 300)
end
entity:update(dt)
end
end;