Mercurial > touhou
annotate pytouhou/game/text.py @ 430:c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 03 Aug 2013 15:49:04 +0200 |
parents | 6c0cb3eee33e |
children | 1222341ea22c |
rev | line source |
---|---|
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 ## |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 ## Copyright (C) 2011 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 ## |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 ## |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 ## GNU General Public License for more details. |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 ## |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 from copy import copy |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 from pytouhou.game.sprite import Sprite |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 from pytouhou.vm.anmrunner import ANMRunner |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
19 from pytouhou.utils.interpolator import Interpolator |
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 class Glyph(object): |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 def __init__(self, sprite, pos): |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
24 self.sprite = sprite |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
25 self.removed = False |
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
26 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 self.x, self.y = pos |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
30 class Widget(object): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
31 def __init__(self, pos, back_anm=None, back_script=22): |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
32 self.sprite = None |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
33 self.removed = False |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
34 self.changed = True |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
35 self.anmrunner = None |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
36 self.frame = 0 |
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
38 # Set up the backround sprite |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
39 self.back_anm = back_anm |
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
40 if back_anm: |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
41 self.sprite = Sprite() |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
42 self.anmrunner = ANMRunner(back_anm, back_script, self.sprite) |
322
4e8192aadcaa
Give a better interface for text handling.
Thibaut Girka <thib@sitedethib.com>
parents:
304
diff
changeset
|
43 self.anmrunner.run_frame() |
4e8192aadcaa
Give a better interface for text handling.
Thibaut Girka <thib@sitedethib.com>
parents:
304
diff
changeset
|
44 |
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 self.x, self.y = pos |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
47 def update(self): |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
48 self.frame += 1 |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
49 if self.changed: |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
50 if self.anmrunner and not self.anmrunner.run_frame(): |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
51 self.anmrunner = None |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
52 self.changed = False |
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
54 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
55 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
56 class GlyphCollection(Widget): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
57 def __init__(self, pos, anm, back_anm=None, ref_script=0, |
381
f1649d6c6397
Don’t hardcode background script for Widget.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
347
diff
changeset
|
58 xspacing=14, back_script=22): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
59 Widget.__init__(self, pos, back_anm, back_script) |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
60 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
61 self.ref_sprite = Sprite() |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
62 self.anm = anm |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
63 self.glyphes = [] |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
64 self.xspacing = xspacing |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
65 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
66 # Set up ref sprite |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
67 anm_runner = ANMRunner(anm, ref_script, self.ref_sprite) |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
68 anm_runner.run_frame() |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
69 self.ref_sprite.corner_relative_placement = True #TODO: perhaps not right |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
70 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
71 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
72 def set_length(self, length): |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
73 current_length = len(self.glyphes) |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
74 if length > current_length: |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
75 self.glyphes.extend(Glyph(copy(self.ref_sprite), |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
76 (self.x + self.xspacing * i, self.y)) |
381
f1649d6c6397
Don’t hardcode background script for Widget.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
347
diff
changeset
|
77 for i in range(current_length, length)) |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
78 elif length < current_length: |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
79 self.glyphes[:] = self.glyphes[:length] |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
80 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
81 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
82 def set_sprites(self, sprite_indexes): |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
83 self.set_length(len(sprite_indexes)) |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
84 for glyph, idx in zip(self.glyphes, sprite_indexes): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
85 glyph.sprite.anm = self.anm |
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
86 glyph.sprite.texcoords = self.anm.sprites[idx] |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
87 glyph.sprite.changed = True |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
88 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
89 |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
90 def set_color(self, color, text=True): |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
91 if text: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
92 colors = {'white': (255, 255, 255), 'yellow': (255, 255, 0), |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
93 'blue': (192, 192, 255), 'darkblue': (160, 128, 255), |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
94 'purple': (224, 128, 255), 'red': (255, 64, 0)} |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
95 color = colors[color] |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
96 self.ref_sprite.color = color |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
97 for glyph in self.glyphes: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
98 glyph.sprite.color = color |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
99 |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
100 |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
101 def set_alpha(self, alpha): |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
102 self.ref_sprite.alpha = alpha |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
103 for glyph in self.glyphes: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
104 glyph.sprite.alpha = alpha |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
105 |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
106 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
107 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
108 class Text(GlyphCollection): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
109 def __init__(self, pos, ascii_anm, back_anm=None, text='', |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
110 xspacing=14, shift=21, back_script=22, align='left'): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
111 GlyphCollection.__init__(self, pos, ascii_anm, back_anm, |
381
f1649d6c6397
Don’t hardcode background script for Widget.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
347
diff
changeset
|
112 xspacing=xspacing, back_script=back_script) |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
113 self.text = '' |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
114 self.shift = shift |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
115 |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
116 if align == 'center': |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
117 self.x -= xspacing * len(text) // 2 |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
118 elif align == 'right': |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
119 self.x -= xspacing * len(text) |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
120 else: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
121 assert align == 'left' |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
122 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
123 self.set_text(text) |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
124 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
125 |
384
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
126 @property |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
127 def objects(self): |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
128 return self.glyphes + [self] |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
129 |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
130 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
131 def set_text(self, text): |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
132 if text == self.text: |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
133 return |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
134 |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
135 self.set_sprites([ord(c) - self.shift for c in text]) |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
136 self.text = text |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
137 self.changed = True |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
138 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
139 |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
140 def timeout_update(self): |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
141 GlyphCollection.update(self) |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
142 if self.frame == self.timeout: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
143 self.removed = True |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
144 |
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
145 |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
146 def move_timeout_update(self): |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
147 GlyphCollection.update(self) |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
148 if self.frame % 2: |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
149 for glyph in self.glyphes: |
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
150 glyph.y -= 1 |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
151 if self.frame == self.timeout: |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
152 self.removed = True |
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
153 |
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
154 |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
155 def fadeout_timeout_update(self): |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
156 GlyphCollection.update(self) |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
157 if self.frame >= self.start: |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
158 if self.frame == self.start: |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
159 self.fade(self.duration, 255, lambda x: x) |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
160 elif self.frame == self.timeout - self.duration: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
161 self.fade(self.duration, 0, lambda x: x) |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
162 if self.fade_interpolator: |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
163 self.fade_interpolator.update(self.frame) |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
164 self.alpha = int(self.fade_interpolator.values[0]) |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
165 for glyph in self.glyphes: |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
166 glyph.sprite.alpha = self.alpha |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
167 glyph.sprite.changed = True |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
168 if self.frame == self.timeout: |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
169 self.removed = True |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
170 |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
171 |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
172 def fade(self, duration, alpha, formula): |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
173 self.fade_interpolator = Interpolator((self.alpha,), self.frame, |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
174 (alpha,), self.frame + duration, |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
175 formula) |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
176 |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
177 |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
178 def set_timeout(self, timeout, effect=None, duration=0, start=0): |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
179 if effect == 'move': |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
180 self.update = self.move_timeout_update |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
181 self.timeout = timeout + start |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
182 elif effect == 'fadeout': |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
183 self.alpha = 0 |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
184 for glyph in self.glyphes: |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
185 glyph.sprite.alpha = 0 |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
186 self.update = self.fadeout_timeout_update |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
187 self.duration = duration |
387
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
188 self.start = start |
e1f5dcd4b83e
Display something at the start of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
189 self.timeout = timeout + start |
404
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
190 else: |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
191 self.update = self.timeout_update |
6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
387
diff
changeset
|
192 self.timeout = timeout + start |
327
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
193 |
13201d90bb22
Display the text when collecting an item.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
323
diff
changeset
|
194 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
195 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
196 class Counter(GlyphCollection): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
197 def __init__(self, pos, anm, back_anm=None, script=0, |
381
f1649d6c6397
Don’t hardcode background script for Widget.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
347
diff
changeset
|
198 xspacing=16, value=0, back_script=22): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
199 GlyphCollection.__init__(self, pos, anm, |
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
200 back_anm=back_anm, ref_script=script, |
381
f1649d6c6397
Don’t hardcode background script for Widget.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
347
diff
changeset
|
201 xspacing=xspacing, back_script=back_script) |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
202 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
203 self.value = value |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
204 self.set_value(value) |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
205 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
206 |
384
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
207 @property |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
208 def objects(self): |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
209 return [self] + self.glyphes |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
210 |
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
211 |
323
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
212 def set_value(self, value): |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
213 if value < 0: |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
214 value = 0 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
215 if value == self.value: |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
216 return |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
217 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
218 self.set_length(value) |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
219 self.value = value |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
220 self.changed = True |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
221 |
2fcdb8966957
Display lives and bombs.
Thibaut Girka <thib@sitedethib.com>
parents:
322
diff
changeset
|
222 |
346
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
223 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
224 class Gauge(object): |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
225 def __init__(self, pos, anm, max_length=280, maximum=1, value=0): |
346
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
226 self.sprite = Sprite() |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
404
diff
changeset
|
227 self.anmrunner = ANMRunner(anm, 21, self.sprite) |
346
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
228 self.anmrunner.run_frame() |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
229 self.removed = False |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
230 self.sprite.corner_relative_placement = True #TODO: perhaps not right |
384
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
381
diff
changeset
|
231 self.objects = [self] |
346
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
232 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
233 self.x, self.y = pos |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
234 self.max_length = max_length |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
235 self.maximum = maximum |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
236 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
237 self.set_value(value) |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
238 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
239 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
240 def set_value(self, value): |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
241 self.value = value |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
242 self.sprite.width_override = self.max_length * value / self.maximum |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
243 self.sprite.changed = True #TODO |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
244 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
245 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
246 def update(self): |
347
b150ed7188a2
Show the size of the spellcard life.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
346
diff
changeset
|
247 #XXX |
b150ed7188a2
Show the size of the spellcard life.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
346
diff
changeset
|
248 if self.value == 0: |
b150ed7188a2
Show the size of the spellcard life.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
346
diff
changeset
|
249 self.sprite.visible = False |
b150ed7188a2
Show the size of the spellcard life.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
346
diff
changeset
|
250 else: |
b150ed7188a2
Show the size of the spellcard life.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
346
diff
changeset
|
251 self.sprite.visible = True |
346
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
252 if self.anmrunner and not self.anmrunner.run_frame(): |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
253 self.anmrunner = None |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
254 |
862011266f2c
Add a gauge and use it for the enemy life bar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
255 |