Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function move_zombies()
- local occupied = {}
- for z in all(zombies) do
- last_x = z.x
- last_y = z.y
- if x > z.x then z.x += z.speed end
- if x < z.x then z.x -= z.speed end
- if collide(z.x,z.y,0) then z.x = last_x end
- if y > z.y then z.y += z.speed end
- if y < z.y then z.y -= z.speed end
- if collide(z.x,z.y,0) then z.y = last_y end
- if hit(z.x,z.y,8,8,x,y,8,8) then
- stop('dead')
- end
- for o in all(occupied) do
- if hit(z.x,z.y,8,8,o.x,o.y,8,8) then
- z.x = last_x
- z.y = last_y
- break
- end
- end
- add (occupied,{x=z.x,y=z.y})
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement