changeset 11:b7a0c1a0e6c4

block some distance from the wall
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 15 Dec 2012 15:57:29 +0100
parents a8111759a5c7
children 731742f852c1
files main.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main.lua	Sat Dec 15 15:54:01 2012 +0100
+++ b/main.lua	Sat Dec 15 15:57:29 2012 +0100
@@ -29,13 +29,13 @@
 
 function makeVillain(villain)
     function villain.sprite:walk(dt, dir)
-        local x = self.x + DX[dir] * dt * 250
-        local y = self.y + DY[dir] * dt * 250
+        local x = self.x + DX[dir] * 24
+        local y = self.y + DY[dir] * 16
         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 not cell.properties.block then
-            self.x = x
-            self.y = y
+            self.x = self.x + DX[dir] * dt * 250
+            self.y = self.y + DY[dir] * dt * 250
         end
     end
     function villain.sprite:update(dt)