summaryrefslogtreecommitdiff
path: root/ghost.lua
diff options
context:
space:
mode:
authorFernando Carmona Varo <ferkiwi@gmail.com>2015-10-22 20:44:07 +0200
committerFernando Carmona Varo <ferkiwi@gmail.com>2015-10-22 20:44:07 +0200
commit1a89f9a8e8e2dd95a1dccb70c10892b604ab434c (patch)
tree62da84057832a2c4f636a467f1648c074153dc0d /ghost.lua
parentc942b65e33df4cc51202f605d037a2a40883c49e (diff)
Stop ghosts when the player leaves
Diffstat (limited to 'ghost.lua')
-rw-r--r--ghost.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/ghost.lua b/ghost.lua
index 4138e8f..a4bd46d 100644
--- a/ghost.lua
+++ b/ghost.lua
@@ -69,6 +69,12 @@ for i in ipairs(ghosts) do
end
local player = self.target
+ -- If there's no player just stop
+ if not player then
+ self.set_velocity(self, 0)
+ return
+ end
+
local s = self.object:getpos() -- ghost
local p = player:getpos() -- player