- commit
- e6bc073f4dbc7b63ba8307fa26e9ba1be34121b5
- parent
- 0252f075b2837d8e775ff335e3dee82dc5657682
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2014-10-31 14:20
add example non-player-sprite
Diffstat
| M | laneya/map.py | 10 | ++++++++++ |
1 files changed, 10 insertions, 0 deletions
diff --git a/laneya/map.py b/laneya/map.py
@@ -1,3 +1,5 @@ -1 1 import random -1 2 1 3 import protocol 2 4 3 5 @@ -18,6 +20,7 @@ class Map(object): 18 20 self.server = server 19 21 self.sprites = {} 20 22 self.movable_layer = [[None for i in xrange(100)] for i in xrange(100)] -1 23 self.ghost = Ghost('example', self, 15, 15) 21 24 22 25 def step(self): 23 26 """Update this map and all of its sprites. @@ -109,4 +112,11 @@ class User(MovingSprite): 109 112 """Sprite representing a user.""" 110 113 111 114 -1 115 class Ghost(MovingSprite): -1 116 def step(self): -1 117 self.direction = random.choice( -1 118 ['north', 'east', 'south', 'west', 'stop']) -1 119 super(Ghost, self).step() -1 120 -1 121 112 122 __all__ = ['Map', 'Sprite', 'MovingSprite', 'User']