annotate skaapsteker/sprites/npcs.py @ 501:9a16483e49cb

Remove 1st set of blocking samuri
author Neil Muller <drnlmuller@gmail.com>
date Sat, 09 Apr 2011 22:40:25 +0200
parents 18427edff33a
children c85363a8ff56
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
460
8b9b4706a4d6 Blocking NPC's block
Neil Muller <drnlmuller@gmail.com>
parents: 451
diff changeset
1 from .base import NPC, BlockingNPC
475
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
2 from pygame import transform
189
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
diff changeset
3
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
diff changeset
4
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
diff changeset
5 class Monk(NPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
6 image_dir = 'sprites/monk'
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
7 animation_regexes = [
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
8 ("meditating", "monk.png"),
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
9 ]
189
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
diff changeset
10
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
diff changeset
11
460
8b9b4706a4d6 Blocking NPC's block
Neil Muller <drnlmuller@gmail.com>
parents: 451
diff changeset
12 class Guard(BlockingNPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
13 image_dir = 'sprites/guard'
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
14
461
c6d1165bb16f Can talk your way past the guard
Neil Muller <drnlmuller@gmail.com>
parents: 460
diff changeset
15 def update(self):
c6d1165bb16f Can talk your way past the guard
Neil Muller <drnlmuller@gmail.com>
parents: 460
diff changeset
16 if not self._me.block and self.block:
c6d1165bb16f Can talk your way past the guard
Neil Muller <drnlmuller@gmail.com>
parents: 460
diff changeset
17 self.collides_with = set([])
c6d1165bb16f Can talk your way past the guard
Neil Muller <drnlmuller@gmail.com>
parents: 460
diff changeset
18 self.block = False
c6d1165bb16f Can talk your way past the guard
Neil Muller <drnlmuller@gmail.com>
parents: 460
diff changeset
19 super(Guard, self).update()
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
20
460
8b9b4706a4d6 Blocking NPC's block
Neil Muller <drnlmuller@gmail.com>
parents: 451
diff changeset
21
468
73868503c470 Make road Samuri blocking
Neil Muller <drnlmuller@gmail.com>
parents: 461
diff changeset
22 class Hattori(BlockingNPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
23 image_dir = 'sprites/hattori'
475
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
24 facings = {
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
25 'running' : (('left', None),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
26 ('right', lambda x: transform.flip(x, True, False))),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
27 'standing' : (('left', None),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
28 ('right', lambda x: transform.flip(x, True, False))),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
29 }
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
30
501
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
31 def update(self):
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
32 if not self._me.block:
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
33 self.remove()
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
34
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
35
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
36
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
37
468
73868503c470 Make road Samuri blocking
Neil Muller <drnlmuller@gmail.com>
parents: 461
diff changeset
38 class Ichiro(BlockingNPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
39 image_dir = 'sprites/ichiro'
475
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
40 facings = {
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
41 'running' : (('left', None),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
42 ('right', lambda x: transform.flip(x, True, False))),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
43 'standing' : (('left', None),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
44 ('right', lambda x: transform.flip(x, True, False))),
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
45 }
18427edff33a Add facing support to npcs
Neil Muller <drnlmuller@gmail.com>
parents: 468
diff changeset
46
501
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
47 def update(self):
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
48 if not self._me.block:
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
49 self.remove()
9a16483e49cb Remove 1st set of blocking samuri
Neil Muller <drnlmuller@gmail.com>
parents: 475
diff changeset
50
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
51
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
52
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
53 class Kaneda(NPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
54 image_dir = 'sprites/kaneda'
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
55
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
56
297
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
57 class Tetsuo(NPC):
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
58 image_dir = 'sprites/tetsuo'
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
59
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
60
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
61 class Kumiko(NPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
62 image_dir = 'sprites/geisha'
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
63
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
64
297
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
65 class FishMonger(NPC):
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
66 image_dir = 'sprites/fishmonger'
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
67 animation_regexes = [
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
68 ("standing", r"^.*_standing.png$"),
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
69 ]
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
70
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
71
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
72 class Maneki(NPC):
436
32df272a163a maneki neko and fisherman's house
Adrianna Pińska <adrianna.pinska@gmail.com>
parents: 418
diff changeset
73 image_dir = 'sprites/maneki neko'
297
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
74 animation_regexes = [
436
32df272a163a maneki neko and fisherman's house
Adrianna Pińska <adrianna.pinska@gmail.com>
parents: 418
diff changeset
75 ("standing", r"^.*_standing.png$"),
297
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
76 ]
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
77
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
78
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
79 class Actor(NPC):
418
c6e9b3006ef9 stuff in theatre
Adrianna Pińska <adrianna.pinska@gmail.com>
parents: 297
diff changeset
80 image_dir = 'sprites/fishmonger'
224
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
81 animation_regexes = [
418
c6e9b3006ef9 stuff in theatre
Adrianna Pińska <adrianna.pinska@gmail.com>
parents: 297
diff changeset
82 ("standing", r"^.*_standing.png$"),
224
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
83 ]
197
6696ffd51ac2 Hordes of NPCs.
Simon Cross <hodgestar@gmail.com>
parents: 189
diff changeset
84
297
2844edb6c1cc Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents: 224
diff changeset
85
468
73868503c470 Make road Samuri blocking
Neil Muller <drnlmuller@gmail.com>
parents: 461
diff changeset
86 class Sasuke(BlockingNPC):
213
c5c4306593d8 Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents: 197
diff changeset
87 image_dir = 'sprites/sasuke'
224
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
88
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
89
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
90 class Kitsune(NPC):
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
91 image_dir = 'sprites'
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
92 animation_regexes = [
451
7f198761a7be boss kitsune
Adrianna Pińska <adrianna.pinska@gmail.com>
parents: 436
diff changeset
93 ("being_evil", "boss_kitsune.png"),
224
5d37c73d46e2 Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents: 213
diff changeset
94 ]