Mercurial > vanillian
diff main.lua @ 3:f5de6c75c4d0
make the walls block
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sat, 15 Dec 2012 13:39:10 +0100 |
| parents | 0c46edeabad6 |
| children | e4263ea87780 |
line wrap: on
line diff
--- a/main.lua Sat Dec 15 13:10:41 2012 +0100 +++ b/main.lua Sat Dec 15 13:39:10 2012 +0100 @@ -18,8 +18,14 @@ anim8.newAnimation('loop', grid('1-2,1'), 0.25) ) function villain:walk(dt, dir) - self.x = self.x + DX[dir] * dt * 250 - self.y = self.y + DY[dir] * dt * 250 + local x = self.x + DX[dir] * dt * 250 + local y = self.y + DY[dir] * dt * 250 + local tx, ty = math.floor((x+32)/48), math.floor((y+60)/48) + local cell = map.layers['control']:get(tx, ty) + if cell and cell.properties and cell.properties.block == 0 then + self.x = x + self.y = y + end end return villain end @@ -44,6 +50,7 @@ sprites[2] = newCivilian(128, 64, civilian_image) shadows[2] = sprite.newShadow(shadow_image, sprites[2]) map = ATL.Loader.load('level01.tmx') + map.drawObjects = false end
