capitalex revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
objects.lua
@@ -6,7 +6,7 @@ local player = Thing() | |||
6 | 6 | self:broadcast "player died" | |
7 | 7 | end) | |
8 | 8 | :mimic "alive" "draw" | |
9 | - | :when "alice" | |
9 | + | :when "alive" | |
10 | 10 | :does "update" (function(self, dt) | |
11 | 11 | self.t = self.t + dt | |
12 | 12 | self.x = self.x + math.cos(self.t) * 100 |
capitalex revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
objects.lua
@@ -2,7 +2,7 @@ local player = Thing() | |||
2 | 2 | :has { t = 0, x = 0, y = 0, w = 32, h = 32 } | |
3 | 3 | :is { "player", "solid" } | |
4 | 4 | :when "dead" | |
5 | - | :on_stsrt(function(self) | |
5 | + | :on_start(function(self) | |
6 | 6 | self:broadcast "player died" | |
7 | 7 | end) | |
8 | 8 | :mimic "alive" "draw" |
capitalex revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
objects.lua
@@ -12,7 +12,7 @@ local player = Thing() | |||
12 | 12 | self.x = self.x + math.cos(self.t) * 100 | |
13 | 13 | self.y = self.y + math.sin(self.t) * 100 | |
14 | 14 | end):unless(function(self) return self.world.paused end) | |
15 | - | :does "draw' (function(self) | |
15 | + | :does "draw" (function(self) | |
16 | 16 | love.graphics.rectangle("fill", self.x, self.y, self.w, self.h) | |
17 | 17 | end) | |
18 | 18 | :does "die" (function(self) |
capitalex revidoval tento gist . Přejít na revizi
1 file changed, 20 insertions
objects.lua(vytvořil soubor)
@@ -0,0 +1,20 @@ | |||
1 | + | local player = Thing() | |
2 | + | :has { t = 0, x = 0, y = 0, w = 32, h = 32 } | |
3 | + | :is { "player", "solid" } | |
4 | + | :when "dead" | |
5 | + | :on_stsrt(function(self) | |
6 | + | self:broadcast "player died" | |
7 | + | end) | |
8 | + | :mimic "alive" "draw" | |
9 | + | :when "alice" | |
10 | + | :does "update" (function(self, dt) | |
11 | + | self.t = self.t + dt | |
12 | + | self.x = self.x + math.cos(self.t) * 100 | |
13 | + | self.y = self.y + math.sin(self.t) * 100 | |
14 | + | end):unless(function(self) return self.world.paused end) | |
15 | + | :does "draw' (function(self) | |
16 | + | love.graphics.rectangle("fill", self.x, self.y, self.w, self.h) | |
17 | + | end) | |
18 | + | :does "die" (function(self) | |
19 | + | self:become "dead" | |
20 | + | end) |