Mercurial > skaapsteker
annotate skaapsteker/sprites/npcs.py @ 559:c4b14a517500
Parital geisha mission
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 10 Apr 2011 01:59:40 +0200 |
parents | 40a104ca0a69 |
children | 1ccb90397c4a |
rev | line source |
---|---|
551 | 1 from .base import NPC, BlockingNPC, PC_LAYER, notify |
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 | 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 | 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 | 20 |
460 | 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 | 36 |
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 | 51 |
52 | |
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 | 55 |
559 | 56 wants_updates = True |
57 | |
544 | 58 animation_regexes = [ |
59 ("standing", r"^.*_standing.png$"), | |
60 ] | |
61 | |
516
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
62 facings = { |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
63 'standing' : (('left', None), |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
64 ('right', lambda x: transform.flip(x, True, False))), |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
65 } |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
66 |
546
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
67 def setup(self, name, world, dsm, state, present, facing=None): |
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
68 super(Kaneda, self).setup(name, world, dsm, state, facing) |
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
69 |
550 | 70 def player_action(self, player): |
546
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
71 if not self._me.present: |
550 | 72 return |
73 super(Kaneda, self).player_action(player) | |
74 | |
75 def update(self): | |
559 | 76 if self.world.missions.kumiko_disgraced and self.alive: |
546
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
77 self.remove() |
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
78 super(Kaneda, self).update() |
05d93c10e5ae
Remove Kaneda after the deal is off
Neil Muller <drnlmuller@gmail.com>
parents:
544
diff
changeset
|
79 |
197 | 80 |
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
|
81 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
|
82 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
|
83 |
544 | 84 animation_regexes = [ |
85 ("standing", r"^.*_standing.png$"), | |
86 ] | |
87 | |
88 | |
516
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
89 facings = { |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
90 'standing' : (('left', None), |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
91 ('right', lambda x: transform.flip(x, True, False))), |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
92 } |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
93 |
9a1f8925d227
added facings for kaneda and tetsuo
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
514
diff
changeset
|
94 |
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
|
95 |
197 | 96 class Kumiko(NPC): |
213
c5c4306593d8
Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents:
197
diff
changeset
|
97 image_dir = 'sprites/geisha' |
197 | 98 |
550 | 99 animation_regexes = [ |
100 ("standing", r"^.*_01.png$"), | |
101 ] | |
102 | |
551 | 103 collides_with = set([PC_LAYER]) |
104 | |
105 def damage(self, damage): | |
106 """Destroy the kimono""" | |
107 if not self.world.missions.kumikos_kimono_torn: | |
108 self.world.missions.kumikos_kimono_torn = True | |
109 notify("Shoo, dirty fox! Oh, look what you've done" | |
559 | 110 "- you've made a great big tear in my finest silk kimono." |
111 "What will the businessman think of a ragged dress like this?") | |
551 | 112 |
197 | 113 |
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
|
114 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
|
115 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
|
116 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
|
117 ("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
|
118 ] |
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
|
119 |
549
b7f912705adb
Fishmonger now mongers fish.
Jeremy Thurgood <firxen@gmail.com>
parents:
546
diff
changeset
|
120 def setup(self, **opts): |
b7f912705adb
Fishmonger now mongers fish.
Jeremy Thurgood <firxen@gmail.com>
parents:
546
diff
changeset
|
121 super(FishMonger, self).setup(**opts) |
b7f912705adb
Fishmonger now mongers fish.
Jeremy Thurgood <firxen@gmail.com>
parents:
546
diff
changeset
|
122 self.world.missions.fishmonger_demons_killed = 0 |
b7f912705adb
Fishmonger now mongers fish.
Jeremy Thurgood <firxen@gmail.com>
parents:
546
diff
changeset
|
123 |
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
|
124 |
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
|
125 class Maneki(NPC): |
436
32df272a163a
maneki neko and fisherman's house
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
418
diff
changeset
|
126 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
|
127 animation_regexes = [ |
436
32df272a163a
maneki neko and fisherman's house
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
418
diff
changeset
|
128 ("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
|
129 ] |
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
|
130 |
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
|
131 |
197 | 132 class Actor(NPC): |
418
c6e9b3006ef9
stuff in theatre
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
297
diff
changeset
|
133 image_dir = 'sprites/fishmonger' |
224
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
134 animation_regexes = [ |
418
c6e9b3006ef9
stuff in theatre
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
297
diff
changeset
|
135 ("standing", r"^.*_standing.png$"), |
224
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
136 ] |
197 | 137 |
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
|
138 |
509
c85363a8ff56
Make Sasuke non-blocking again
Neil Muller <drnlmuller@gmail.com>
parents:
501
diff
changeset
|
139 class Sasuke(NPC): |
213
c5c4306593d8
Attempt to animate NPCs a bit.
Simon Cross <hodgestar@gmail.com>
parents:
197
diff
changeset
|
140 image_dir = 'sprites/sasuke' |
224
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
141 |
525 | 142 def setup(self, name, world, dsm, state, present, facing=None): |
514 | 143 self._animation = 'standing' |
144 super(Sasuke, self).setup(name, world, dsm, state, facing) | |
145 | |
525 | 146 def update(self): |
147 if not self._me.present: | |
148 self.remove() | |
526
5613f7b61b23
Stop Sasuke falling off the world
Neil Muller <drnlmuller@gmail.com>
parents:
525
diff
changeset
|
149 super(Sasuke, self).update() |
224
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
150 |
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
151 class Kitsune(NPC): |
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
152 image_dir = 'sprites' |
5d37c73d46e2
Fix actor sprite a bit. Add evil kitsune sprite.
Simon Cross <hodgestar@gmail.com>
parents:
213
diff
changeset
|
153 animation_regexes = [ |
451 | 154 ("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
|
155 ] |