Mercurial > touhou
annotate pytouhou/game/enemy.py @ 382:b9aecdc6f72f
Fix the anmviewer, broken since changeset 370:74471afbac37.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 07 Sep 2012 13:04:30 +0200 |
parents | e0e284fcb288 |
children | 690b5faaa0e6 |
rev | line source |
---|---|
52
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
2 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
3 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
4 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
8 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
12 ## GNU General Public License for more details. |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
13 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
14 |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
50
diff
changeset
|
15 |
20
6ebf9539c077
Handle more enemies types and movements
Thibaut Girka <thib@sitedethib.com>
parents:
18
diff
changeset
|
16 from pytouhou.utils.interpolator import Interpolator |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
68
diff
changeset
|
17 from pytouhou.vm.anmrunner import ANMRunner |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
18 from pytouhou.game.sprite import Sprite |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
19 from pytouhou.game.bullet import Bullet |
274
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
20 from pytouhou.game.laser import Laser |
242
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
21 from pytouhou.game.effect import Effect |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
22 from math import cos, sin, atan2, pi |
335
2350147cf043
Fix bullet cancellation and removal
Thibaut Girka <thib@sitedethib.com>
parents:
329
diff
changeset
|
23 from pytouhou.game.bullet import LAUNCHED |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
24 |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
25 |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
26 class Enemy(object): |
171
2f3665a77f11
Add support for the last unknown value of the enemy spawning.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
167
diff
changeset
|
27 def __init__(self, pos, life, _type, bonus_dropped, die_score, anm_wrapper, game): |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
28 self._game = game |
49
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
29 self._anm_wrapper = anm_wrapper |
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
30 self._type = _type |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
31 |
316
f0be7ea62330
Fix a bug with ECL instruction 96, and fix overall ECL handling.
Thibaut Girka <thib@sitedethib.com>
parents:
311
diff
changeset
|
32 self.process = None |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
33 self.sprite = None |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
34 self.anmrunner = None |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
35 self.removed = False |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
36 self.visible = True |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
37 self.was_visible = False |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
38 self.bonus_dropped = bonus_dropped |
319
9a4119e2cc74
Use Enemy.die_score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
318
diff
changeset
|
39 self.die_score = die_score |
49
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
40 |
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
41 self.frame = 0 |
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
42 |
270
7a9135b88853
Partially fix some of Flandre's spellcards.
Thibaut Girka <thib@sitedethib.com>
parents:
268
diff
changeset
|
43 self.x, self.y, self.z = pos |
209
005ea47e11e0
Create enemy with negative life as it should be.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
207
diff
changeset
|
44 self.life = 1 if life < 0 else life |
67
e2cb9d434dc2
Add support for a few opcodes.
Thibaut Girka <thib@sitedethib.com>
parents:
62
diff
changeset
|
45 self.touchable = True |
210
f5be441d2c42
Implement collidable boolean of enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
209
diff
changeset
|
46 self.collidable = True |
67
e2cb9d434dc2
Add support for a few opcodes.
Thibaut Girka <thib@sitedethib.com>
parents:
62
diff
changeset
|
47 self.damageable = True |
e2cb9d434dc2
Add support for a few opcodes.
Thibaut Girka <thib@sitedethib.com>
parents:
62
diff
changeset
|
48 self.death_flags = 0 |
177
6e8653ff2b23
Fix boss mode and don’t suicide the boss when she just want to kill the other enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
173
diff
changeset
|
49 self.boss = False |
182
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
50 self.difficulty_coeffs = (-.5, .5, 0, 0, 0, 0) |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
51 self.extended_bullet_attributes = (0, 0, 0, 0, 0., 0., 0., 0.) |
274
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
52 self.current_laser_id = 0 |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
53 self.laser_by_id = {} |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
54 self.bullet_attributes = None |
36 | 55 self.bullet_launch_offset = (0, 0) |
268
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
56 self.death_callback = -1 |
307 | 57 self.boss_callback = -1 |
268
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
58 self.low_life_callback = -1 |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
59 self.low_life_trigger = None |
268
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
60 self.timeout = -1 |
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
61 self.timeout_callback = -1 |
350
b3049fb5c448
Fix remaining lives display issue
Thibaut Girka <thib@sitedethib.com>
parents:
346
diff
changeset
|
62 self.remaining_lives = 0 |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
63 |
75
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
73
diff
changeset
|
64 self.automatic_orientation = False |
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
73
diff
changeset
|
65 |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
66 self.bullet_launch_interval = 0 |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
67 self.bullet_launch_timer = 0 |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
68 self.delay_attack = False |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
69 |
167
e483b5a7e84b
Fix default death animation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
166
diff
changeset
|
70 self.death_anim = 0 |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
71 self.movement_dependant_sprites = None |
22 | 72 self.direction = None |
20
6ebf9539c077
Handle more enemies types and movements
Thibaut Girka <thib@sitedethib.com>
parents:
18
diff
changeset
|
73 self.interpolator = None #TODO |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
74 self.speed_interpolator = None |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
75 self.update_mode = 0 |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
76 self.angle = 0. |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
77 self.speed = 0. |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
78 self.rotation_speed = 0. |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
79 self.acceleration = 0. |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
80 |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
81 self.hitbox = (0, 0) |
152
86807b8a63bd
Add collisions with enemies and items.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
151
diff
changeset
|
82 self.hitbox_half_size = (0, 0) |
50
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
83 self.screen_box = None |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
84 |
242
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
85 self.aux_anm = 8 * [None] |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
86 |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
87 |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
88 def objects(self): |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
89 return [anm for anm in self.aux_anm if anm] |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
90 |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
91 |
343
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
92 def play_sound(self, index): |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
93 name = { |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
94 5: 'power0', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
95 6: 'power1', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
96 7: 'tan00', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
97 8: 'tan01', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
98 9: 'tan02', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
99 14: 'cat00', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
100 16: 'lazer00', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
101 17: 'lazer01', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
102 18: 'enep01', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
103 22: 'tan00', #XXX |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
104 24: 'tan02', #XXX |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
105 25: 'kira00', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
106 26: 'kira01', |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
107 27: 'kira02' |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
108 }[index] |
379
e0e284fcb288
Make a sound when an enemy is hit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
366
diff
changeset
|
109 self._game.sfx_player.play('%s.wav' % name) |
343
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
110 |
94fdb6c782c1
Implement sfx for player and enemies.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
335
diff
changeset
|
111 |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
112 def set_bullet_attributes(self, type_, anim, sprite_idx_offset, |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
113 bullets_per_shot, number_of_shots, speed, speed2, |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
114 launch_angle, angle, flags): |
182
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
115 |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
116 # Apply difficulty-specific modifiers |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
117 speed_a, speed_b, nb_a, nb_b, shots_a, shots_b = self.difficulty_coeffs |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
118 diff_coeff = self._game.difficulty / 32. |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
119 |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
120 speed += speed_a * (1. - diff_coeff) + speed_b * diff_coeff |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
121 speed2 += (speed_a * (1. - diff_coeff) + speed_b * diff_coeff) / 2. |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
122 bullets_per_shot += int(nb_a * (1. - diff_coeff) + nb_b * diff_coeff) |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
123 number_of_shots += int(shots_a * (1. - diff_coeff) + shots_b * diff_coeff) |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
124 |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
125 self.bullet_attributes = (type_, anim, sprite_idx_offset, bullets_per_shot, |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
126 number_of_shots, speed, speed2, launch_angle, |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
127 angle, flags) |
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
128 if not self.delay_attack: |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
129 self.fire() |
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
130 |
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
131 |
329
1bb78c469f64
Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
Thibaut Girka <thib@sitedethib.com>
parents:
328
diff
changeset
|
132 def set_bullet_launch_interval(self, value, start=0): |
182
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
133 # Apply difficulty-specific modifiers: |
329
1bb78c469f64
Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
Thibaut Girka <thib@sitedethib.com>
parents:
328
diff
changeset
|
134 #TODO: check every value possible! Look around 102h.exe@0x408720 |
1bb78c469f64
Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
Thibaut Girka <thib@sitedethib.com>
parents:
328
diff
changeset
|
135 value -= value * (self._game.difficulty - 16) // 80 |
182
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
136 |
329
1bb78c469f64
Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
Thibaut Girka <thib@sitedethib.com>
parents:
328
diff
changeset
|
137 self.bullet_launch_interval = value |
1bb78c469f64
Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
Thibaut Girka <thib@sitedethib.com>
parents:
328
diff
changeset
|
138 self.bullet_launch_timer = start % value if value else 0 |
182
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
139 |
20843875ad8f
(Hopefully) use difficulty as it should.
Thibaut Girka <thib@sitedethib.com>
parents:
181
diff
changeset
|
140 |
207 | 141 def fire(self, offset=None, bullet_attributes=None, launch_pos=None): |
123 | 142 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots, |
207 | 143 speed, speed2, launch_angle, angle, flags) = bullet_attributes or self.bullet_attributes |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
144 |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
145 bullet_type = self._game.bullet_types[type_idx] |
123 | 146 |
207 | 147 if not launch_pos: |
148 ox, oy = offset or self.bullet_launch_offset | |
149 launch_pos = self.x + ox, self.y + oy | |
109
e93a7ed4f203
Implement bullet_launch_offset thing
Thibaut Girka <thib@sitedethib.com>
parents:
108
diff
changeset
|
150 |
270
7a9135b88853
Partially fix some of Flandre's spellcards.
Thibaut Girka <thib@sitedethib.com>
parents:
268
diff
changeset
|
151 if speed < 0.3 and speed != 0.0: |
253
ea4832f843aa
Fix initial bullet speed
Thibaut Girka <thib@sitedethib.com>
parents:
251
diff
changeset
|
152 speed = 0.3 |
104
6c59d0eeb5fa
Implement ECL instruction 75 in the same exact way as 102h.exe
Thibaut Girka <thib@sitedethib.com>
parents:
103
diff
changeset
|
153 if speed2 < 0.3: |
6c59d0eeb5fa
Implement ECL instruction 75 in the same exact way as 102h.exe
Thibaut Girka <thib@sitedethib.com>
parents:
103
diff
changeset
|
154 speed2 = 0.3 |
6c59d0eeb5fa
Implement ECL instruction 75 in the same exact way as 102h.exe
Thibaut Girka <thib@sitedethib.com>
parents:
103
diff
changeset
|
155 |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
156 self.bullet_launch_timer = 0 |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
157 |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
158 player = self.select_player() |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
159 |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
160 if type_ in (67, 69, 71): |
132
fba45c37ec99
Fix initial angle of bullets with bullet_launch_offset enabled.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
130
diff
changeset
|
161 launch_angle += self.get_player_angle(player, launch_pos) |
247
fb3a263213d1
Fix instruction 70 to always fire to the right.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
242
diff
changeset
|
162 if type_ == 71 and bullets_per_shot % 2 or type_ in (69, 70) and not bullets_per_shot % 2: |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
163 launch_angle += pi / bullets_per_shot |
104
6c59d0eeb5fa
Implement ECL instruction 75 in the same exact way as 102h.exe
Thibaut Girka <thib@sitedethib.com>
parents:
103
diff
changeset
|
164 if type_ != 75: |
6c59d0eeb5fa
Implement ECL instruction 75 in the same exact way as 102h.exe
Thibaut Girka <thib@sitedethib.com>
parents:
103
diff
changeset
|
165 launch_angle -= angle * (bullets_per_shot - 1) / 2. |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
166 |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
167 bullets = self._game.bullets |
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
168 nb_bullets_max = self._game.nb_bullets_max |
106 | 169 |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
170 for shot_nb in range(number_of_shots): |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
171 shot_speed = speed if shot_nb == 0 else speed + (speed2 - speed) * float(shot_nb) / float(number_of_shots) |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
172 bullet_angle = launch_angle |
311
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
173 if type_ in (69, 70, 71, 74): |
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
174 launch_angle += angle |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
175 for bullet_nb in range(bullets_per_shot): |
143 | 176 if nb_bullets_max is not None and len(bullets) == nb_bullets_max: |
177 break | |
178 | |
135
c53d91300c1c
Implement instruction 74.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
134
diff
changeset
|
179 if type_ == 75: # 102h.exe@0x4138cf |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
180 bullet_angle = self._game.prng.rand_double() * (launch_angle - angle) + angle |
135
c53d91300c1c
Implement instruction 74.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
134
diff
changeset
|
181 if type_ in (74, 75): # 102h.exe@0x4138cf |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
182 shot_speed = self._game.prng.rand_double() * (speed - speed2) + speed2 |
123 | 183 bullets.append(Bullet(launch_pos, bullet_type, sprite_idx_offset, |
106 | 184 bullet_angle, shot_speed, |
185 self.extended_bullet_attributes, | |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
186 flags, player, self._game)) |
311
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
187 |
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
188 if type_ in (69, 70, 71, 74): |
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
189 bullet_angle += 2. * pi / bullets_per_shot |
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
190 else: |
550ec10cccbc
Fix angle between salves of circle-distributed bullets.
Thibaut Girka <thib@sitedethib.com>
parents:
309
diff
changeset
|
191 bullet_angle += angle |
48
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
192 |
8353c33d53d4
Support a few more instructions
Thibaut Girka <thib@sitedethib.com>
parents:
46
diff
changeset
|
193 |
274
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
194 def new_laser(self, variant, laser_type, sprite_idx_offset, angle, speed, |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
195 start_offset, end_offset, max_length, width, |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
196 start_duration, duration, end_duration, |
309
14c9aca8e274
Implement Remilia's laser webs.
Thibaut Girka <thib@sitedethib.com>
parents:
307
diff
changeset
|
197 grazing_delay, grazing_extra_duration, unknown, |
14c9aca8e274
Implement Remilia's laser webs.
Thibaut Girka <thib@sitedethib.com>
parents:
307
diff
changeset
|
198 offset=None): |
14c9aca8e274
Implement Remilia's laser webs.
Thibaut Girka <thib@sitedethib.com>
parents:
307
diff
changeset
|
199 ox, oy = offset or self.bullet_launch_offset |
277
219edad0f395
Fix initial laser offset.
Thibaut Girka <thib@sitedethib.com>
parents:
274
diff
changeset
|
200 launch_pos = self.x + ox, self.y + oy |
274
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
201 if variant == 86: |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
202 angle += self.get_player_angle(self.select_player(), launch_pos) |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
203 laser = Laser(launch_pos, self._game.laser_types[laser_type], |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
204 sprite_idx_offset, angle, speed, |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
205 start_offset, end_offset, max_length, width, |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
206 start_duration, duration, end_duration, grazing_delay, |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
207 grazing_extra_duration, self._game) |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
208 self._game.lasers.append(laser) |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
209 self.laser_by_id[self.current_laser_id] = laser |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
210 |
f037bca24f2d
Partially implement lasers.
Thibaut Girka <thib@sitedethib.com>
parents:
270
diff
changeset
|
211 |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
212 def select_player(self, players=None): |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
213 return (players or self._game.players)[0] #TODO |
50
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
214 |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
215 |
132
fba45c37ec99
Fix initial angle of bullets with bullet_launch_offset enabled.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
130
diff
changeset
|
216 def get_player_angle(self, player=None, pos=None): |
79
ffe2c2b9912c
Handle a few more ECL instructions. Prepare for bullet handling \o/
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
217 player = player or self.select_player() |
132
fba45c37ec99
Fix initial angle of bullets with bullet_launch_offset enabled.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
130
diff
changeset
|
218 x, y = pos or (self.x, self.y) |
fba45c37ec99
Fix initial angle of bullets with bullet_launch_offset enabled.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
130
diff
changeset
|
219 return atan2(player.y - y, player.x - x) |
50
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
220 |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
221 |
49
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
222 def set_anim(self, index): |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
223 self.sprite = Sprite() |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
224 self.anmrunner = ANMRunner(self._anm_wrapper, index, self.sprite) |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
225 self.anmrunner.run_frame() |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
226 |
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
227 |
166
dcf32488a2c9
Better enemy death, with animation and (hopefully) correct flags handling.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
159
diff
changeset
|
228 def die_anim(self): |
248
77b83064b57e
Use the correct animation for player death.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
247
diff
changeset
|
229 anim = {0: 3, 1: 4, 2: 5}[self.death_anim % 256] # The TB is wanted, if index isn’t in these values the original game crashs. |
77b83064b57e
Use the correct animation for player death.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
247
diff
changeset
|
230 self._game.new_effect((self.x, self.y), anim) |
379
e0e284fcb288
Make a sound when an enemy is hit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
366
diff
changeset
|
231 self._game.sfx_player.play('enep00.wav') |
190
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
232 |
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
233 |
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
234 def drop_particles(self, number, color): |
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
235 if color == 0: |
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
236 if self._game.stage in [1, 2, 7]: |
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
237 color = 3 |
dbe6b7b2d3fc
Fix a few things about particles.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
184
diff
changeset
|
238 for i in range(number): |
328
56523a16db1d
Fix some replay synchronization issues and update the TODO.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
320
diff
changeset
|
239 self._game.new_particle((self.x, self.y), color, 3., 256) #TODO: find the real size. |
154
364935f6e313
Implement enemy killing.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
152
diff
changeset
|
240 |
364935f6e313
Implement enemy killing.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
152
diff
changeset
|
241 |
242
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
242 def set_aux_anm(self, number, script): |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
243 self.aux_anm[number] = Effect((self.x, self.y), script, self._anm_wrapper) |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
244 |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
245 |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
246 def set_pos(self, x, y, z): |
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
247 self.x, self.y = x, y |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
248 self.update_mode = 1 |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
249 self.interpolator = Interpolator((x, y)) |
151
5cf927cbd9c5
Merge GameState into Game. TODO: Merge PlayerState into Player
Thibaut Girka <thib@sitedethib.com>
parents:
143
diff
changeset
|
250 self.interpolator.set_interpolation_start(self._game.frame, (x, y)) |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
251 |
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
252 |
62
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
253 def move_to(self, duration, x, y, z, formula): |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
254 frame = self._game.frame |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
255 self.speed_interpolator = None |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
256 self.update_mode = 1 |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
257 self.interpolator = Interpolator((self.x, self.y), formula) |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
258 self.interpolator.set_interpolation_start(frame, (self.x, self.y)) |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
259 self.interpolator.set_interpolation_end(frame + duration - 1, (x, y)) |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
260 |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
261 self.angle = atan2(y - self.y, x - self.x) |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
262 |
75
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
73
diff
changeset
|
263 |
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
73
diff
changeset
|
264 def stop_in(self, duration, formula): |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
265 frame = self._game.frame |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
266 self.interpolator = None |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
267 self.update_mode = 1 |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
268 self.speed_interpolator = Interpolator((self.speed,), formula) |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
269 self.speed_interpolator.set_interpolation_start(frame, (self.speed,)) |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
270 self.speed_interpolator.set_interpolation_end(frame + duration - 1, (0.,)) |
75
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
73
diff
changeset
|
271 |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
272 |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
273 def is_visible(self, screen_width, screen_height): |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
274 if self.sprite: |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
275 tx, ty, tw, th = self.sprite.texcoords |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
276 if self.sprite.corner_relative_placement: |
73
e4af16a019d3
Do not remove enemies as soon as they lose their animation (Daiyousei...)
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
277 raise Exception #TODO |
e4af16a019d3
Do not remove enemies as soon as they lose their animation (Daiyousei...)
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
278 else: |
e4af16a019d3
Do not remove enemies as soon as they lose their animation (Daiyousei...)
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
279 tx, ty, tw, th = 0., 0., 0., 0. |
29
afa91be769ae
Don't lose time updating off-screen enemies' sprites
Thibaut Girka <thib@sitedethib.com>
parents:
23
diff
changeset
|
280 |
123 | 281 x, y = self.x, self.y |
73
e4af16a019d3
Do not remove enemies as soon as they lose their animation (Daiyousei...)
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
282 max_x = tw / 2. |
e4af16a019d3
Do not remove enemies as soon as they lose their animation (Daiyousei...)
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
283 max_y = th / 2. |
29
afa91be769ae
Don't lose time updating off-screen enemies' sprites
Thibaut Girka <thib@sitedethib.com>
parents:
23
diff
changeset
|
284 |
123 | 285 if (max_x < x - screen_width |
286 or max_x < -x | |
287 or max_y < y - screen_height | |
288 or max_y < -y): | |
23
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
289 return False |
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
290 return True |
444ac7bca7bc
Refacto ECL stuff, add support for a few instructions, and add some culling
Thibaut Girka <thib@sitedethib.com>
parents:
22
diff
changeset
|
291 |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
292 |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
293 def check_collisions(self): |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
294 # Check for collisions |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
295 ex, ey = self.x, self.y |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
296 ehalf_size_x, ehalf_size_y = self.hitbox_half_size |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
297 ex1, ex2 = ex - ehalf_size_x, ex + ehalf_size_x |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
298 ey1, ey2 = ey - ehalf_size_y, ey + ehalf_size_y |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
299 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
300 damages = 0 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
301 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
302 # Check for enemy-bullet collisions |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
303 for bullet in self._game.players_bullets: |
335
2350147cf043
Fix bullet cancellation and removal
Thibaut Girka <thib@sitedethib.com>
parents:
329
diff
changeset
|
304 if bullet.state != LAUNCHED: |
2350147cf043
Fix bullet cancellation and removal
Thibaut Girka <thib@sitedethib.com>
parents:
329
diff
changeset
|
305 continue |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
306 half_size = bullet.hitbox_half_size |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
307 bx, by = bullet.x, bullet.y |
220
0595315d3880
Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
212
diff
changeset
|
308 bx1, bx2 = bx - half_size[0], bx + half_size[0] |
0595315d3880
Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
212
diff
changeset
|
309 by1, by2 = by - half_size[1], by + half_size[1] |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
310 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
311 if not (bx2 < ex1 or bx1 > ex2 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
312 or by2 < ey1 or by1 > ey2): |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
313 bullet.collide() |
268
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
314 if self.damageable: |
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
315 damages += bullet.damage |
379
e0e284fcb288
Make a sound when an enemy is hit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
366
diff
changeset
|
316 self._game.sfx_player.play('damage00.wav') |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
317 |
294
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
318 # Check for enemy-laser collisions |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
319 for laser in self._game.players_lasers: |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
320 if not laser: |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
321 continue |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
322 |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
323 half_size = laser.hitbox_half_size |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
324 lx, ly = laser.x, laser.y * 2. |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
325 lx1, lx2 = lx - half_size[0], lx + half_size[0] |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
326 |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
327 if not (lx2 < ex1 or lx1 > ex2 |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
328 or ly < ey1): |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
329 if self.damageable: |
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
330 damages += laser.damage |
379
e0e284fcb288
Make a sound when an enemy is hit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
366
diff
changeset
|
331 self._game.sfx_player.play('damage00.wav') |
328
56523a16db1d
Fix some replay synchronization issues and update the TODO.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
320
diff
changeset
|
332 self.drop_particles(1, 1) #TODO: don’t call each frame. |
294
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
282
diff
changeset
|
333 |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
334 # Check for enemy-player collisions |
212
78e9957ad344
Hopefully fix enemy-player collision
Thibaut Girka <thib@sitedethib.com>
parents:
210
diff
changeset
|
335 ex1, ex2 = ex - ehalf_size_x * 2. / 3., ex + ehalf_size_x * 2. / 3. |
78e9957ad344
Hopefully fix enemy-player collision
Thibaut Girka <thib@sitedethib.com>
parents:
210
diff
changeset
|
336 ey1, ey2 = ey - ehalf_size_y * 2. / 3., ey + ehalf_size_y * 2. / 3. |
210
f5be441d2c42
Implement collidable boolean of enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
209
diff
changeset
|
337 if self.collidable: |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
338 for player in self._game.players: |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
339 px, py = player.x, player.y |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
340 phalf_size = player.hitbox_half_size |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
341 px1, px2 = px - phalf_size, px + phalf_size |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
342 py1, py2 = py - phalf_size, py + phalf_size |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
343 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
344 #TODO: box-box or point-in-box? |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
345 if not (ex2 < px1 or ex1 > px2 or ey2 < py1 or ey1 > py2): |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
346 if not self.boss: |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
347 damages += 10 |
212
78e9957ad344
Hopefully fix enemy-player collision
Thibaut Girka <thib@sitedethib.com>
parents:
210
diff
changeset
|
348 player.collide() |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
349 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
350 # Adjust damages |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
351 damages = min(70, damages) |
300
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
294
diff
changeset
|
352 score = (damages // 5) * 10 |
da53bc29b94a
Add the game interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
294
diff
changeset
|
353 self._game.players[0].state.score += score #TODO: better distribution amongst the players. |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
354 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
355 if self._game.spellcard: |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
356 #TODO: there is a division by 3, somewhere... where is it? |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
357 if damages <= 7: |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
358 damages = 1 if damages else 0 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
359 else: |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
360 damages //= 7 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
361 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
362 # Apply damages |
268
dd621ad72beb
Fix callback handling and damage dealing.
Thibaut Girka <thib@sitedethib.com>
parents:
253
diff
changeset
|
363 self.life -= damages |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
364 |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
365 |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
366 def handle_callbacks(self): |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
367 #TODO: implement missing callbacks and clean up! |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
368 if self.life <= 0 and self.touchable: |
354 | 369 self.timeout = -1 #TODO: not really true, the timeout is frozen |
370 self.timeout_callback = -1 | |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
371 death_flags = self.death_flags & 7 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
372 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
373 self.die_anim() |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
374 |
319
9a4119e2cc74
Use Enemy.die_score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
318
diff
changeset
|
375 #TODO: verify if the score is added with all the different flags. |
9a4119e2cc74
Use Enemy.die_score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
318
diff
changeset
|
376 self._game.players[0].state.score += self.die_score #TODO: better distribution amongst the players. |
9a4119e2cc74
Use Enemy.die_score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
318
diff
changeset
|
377 |
320
1a4ffdda8735
Cancel the bullets when a boss is killed and transfer them to the score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
319
diff
changeset
|
378 #TODO: verify if that should really be there. |
1a4ffdda8735
Cancel the bullets when a boss is killed and transfer them to the score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
319
diff
changeset
|
379 if self.boss: |
1a4ffdda8735
Cancel the bullets when a boss is killed and transfer them to the score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
319
diff
changeset
|
380 self._game.change_bullets_into_bonus() |
1a4ffdda8735
Cancel the bullets when a boss is killed and transfer them to the score.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
319
diff
changeset
|
381 |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
382 if death_flags < 4: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
383 if self.bonus_dropped > -1: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
384 self.drop_particles(7, 0) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
385 self._game.drop_bonus(self.x, self.y, self.bonus_dropped) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
386 elif self.bonus_dropped == -1: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
387 if self._game.deaths_count % 3 == 0: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
388 self.drop_particles(10, 0) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
389 self._game.drop_bonus(self.x, self.y, self._game.bonus_list[self._game.next_bonus]) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
390 self._game.next_bonus = (self._game.next_bonus + 1) % 32 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
391 else: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
392 self.drop_particles(4, 0) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
393 self._game.deaths_count += 1 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
394 else: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
395 self.drop_particles(4, 0) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
396 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
397 if death_flags == 0: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
398 self.removed = True |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
399 return |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
400 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
401 if death_flags == 1: |
357 | 402 if self.boss: |
403 self.boss = False #TODO: really? | |
404 self._game.boss = None | |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
405 self.touchable = False |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
406 elif death_flags == 2: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
407 pass # Just that? |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
408 elif death_flags == 3: |
357 | 409 if self.boss: |
410 self.boss = False #TODO: really? | |
411 self._game.boss = None | |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
412 self.damageable = False |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
413 self.life = 1 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
414 self.death_flags = 0 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
415 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
416 if death_flags != 0 and self.death_callback > -1: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
417 self.process.switch_to_sub(self.death_callback) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
418 self.death_callback = -1 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
419 elif self.life <= self.low_life_trigger and self.low_life_callback > -1: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
420 self.process.switch_to_sub(self.low_life_callback) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
421 self.low_life_callback = -1 |
354 | 422 self.low_life_trigger = -1 |
423 self.timeout_callback = -1 | |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
424 elif self.timeout != -1 and self.frame == self.timeout: |
366 | 425 self.frame = 0 |
354 | 426 self.timeout = -1 |
358
488c094ed51d
Make bosses clean their mess when timeouting
Thibaut Girka <thib@sitedethib.com>
parents:
357
diff
changeset
|
427 self._game.kill_enemies() |
488c094ed51d
Make bosses clean their mess when timeouting
Thibaut Girka <thib@sitedethib.com>
parents:
357
diff
changeset
|
428 self._game.cancel_bullets() |
354 | 429 |
430 if self.low_life_trigger > 0: | |
431 self.life = self.low_life_trigger | |
432 self.low_life_trigger = -1 | |
433 | |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
434 if self.timeout_callback > -1: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
435 self.process.switch_to_sub(self.timeout_callback) |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
436 self.timeout_callback = -1 |
354 | 437 #TODO: this is only done under certain (unknown) conditions! |
438 # but it shouldn't hurt anyway, as the only option left is to crash! | |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
439 elif self.death_callback > -1: |
366 | 440 self.life = 0 #TODO: do this next frame? Bypass self.touchable? |
318
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
441 else: |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
442 raise Exception('What the hell, man!') |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
443 |
1366cefd0334
Move callbacks handling inside Enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
316
diff
changeset
|
444 |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
68
diff
changeset
|
445 def update(self): |
316
f0be7ea62330
Fix a bug with ECL instruction 96, and fix overall ECL handling.
Thibaut Girka <thib@sitedethib.com>
parents:
311
diff
changeset
|
446 if self.process: |
f0be7ea62330
Fix a bug with ECL instruction 96, and fix overall ECL handling.
Thibaut Girka <thib@sitedethib.com>
parents:
311
diff
changeset
|
447 self.process.run_iteration() |
f0be7ea62330
Fix a bug with ECL instruction 96, and fix overall ECL handling.
Thibaut Girka <thib@sitedethib.com>
parents:
311
diff
changeset
|
448 |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
449 x, y = self.x, self.y |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
450 |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
451 if self.update_mode == 1: |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
452 speed = 0.0 |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
453 if self.interpolator: |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
454 self.interpolator.update(self._game.frame) |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
455 x, y = self.interpolator.values |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
456 if self.speed_interpolator: |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
457 self.speed_interpolator.update(self._game.frame) |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
458 speed, = self.speed_interpolator.values |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
459 else: |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
460 speed = self.speed |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
461 self.speed += self.acceleration |
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
462 self.angle += self.rotation_speed |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
463 |
251
4b549894ef6b
Change position/speed interpoletor handling to match the original game more closely.
Thibaut Girka <thib@sitedethib.com>
parents:
248
diff
changeset
|
464 dx, dy = cos(self.angle) * speed, sin(self.angle) * speed |
49
cbe1cb50f2fd
Refactor ECLRunner/EnemyManager so that all VM stuff goes to ECLRunner
Thibaut Girka <thib@sitedethib.com>
parents:
48
diff
changeset
|
465 if self._type & 2: |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
466 x -= dx |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
467 else: |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
468 x += dx |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
469 y += dy |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
470 |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
471 if self.movement_dependant_sprites: |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
472 #TODO: is that really how it works? Almost. |
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
473 # Sprite determination is done only once per changement, and is |
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
56
diff
changeset
|
474 # superseeded by ins_97. |
62
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
475 end_left, end_right, left, right = self.movement_dependant_sprites |
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
476 if x < self.x and self.direction != -1: |
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
477 self.set_anim(left) |
22 | 478 self.direction = -1 |
62
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
479 elif x > self.x and self.direction != +1: |
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
480 self.set_anim(right) |
22 | 481 self.direction = +1 |
62
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
482 elif x == self.x and self.direction is not None: |
1f591adcea04
Fix animation determination (ins_98 stuff) and some interpolation functions
Thibaut Girka <thib@sitedethib.com>
parents:
57
diff
changeset
|
483 self.set_anim({-1: end_left, +1: end_right}[self.direction]) |
22 | 484 self.direction = None |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
485 |
50
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
486 |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
487 if self.screen_box: |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
488 xmin, ymin, xmax, ymax = self.screen_box |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
489 x = max(xmin, min(x, xmax)) |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
490 y = max(ymin, min(y, ymax)) |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
491 |
811cefefb5c8
Fix a few bugs and add support for a few instructions
Thibaut Girka <thib@sitedethib.com>
parents:
49
diff
changeset
|
492 |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
20
diff
changeset
|
493 self.x, self.y = x, y |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
68
diff
changeset
|
494 |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
68
diff
changeset
|
495 #TODO |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
496 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
|
497 self.anmrunner = None |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
68
diff
changeset
|
498 |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
499 if self.sprite and self.visible: |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
500 if self.sprite.removed: |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
501 self.sprite = None |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
68
diff
changeset
|
502 else: |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
503 self.sprite.update_orientation(self.angle, |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
300
diff
changeset
|
504 self.automatic_orientation) |
36 | 505 |
83
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
506 |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
507 if self.bullet_launch_interval != 0: |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
508 self.bullet_launch_timer += 1 |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
509 if self.bullet_launch_timer == self.bullet_launch_interval: |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
510 self.fire() |
fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
Thibaut Girka <thib@sitedethib.com>
parents:
79
diff
changeset
|
511 |
202
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
512 # Check collisions |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
513 if self.touchable: |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
514 self.check_collisions() |
d348892ef012
Handle enemy collisions and damages in a way closer to the original game.
Thibaut Girka <thib@sitedethib.com>
parents:
197
diff
changeset
|
515 |
242
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
516 for anm in self.aux_anm: |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
517 if anm: |
282
dbb1a86c0235
Rename Animations to ANM0 and prepare AnmWrapper for dialogs and interface.
Thibaut Girka <thib@sitedethib.com>
parents:
277
diff
changeset
|
518 anm.x, anm.y = self.x, self.y |
242
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
519 anm.update() |
1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
234
diff
changeset
|
520 |
328
56523a16db1d
Fix some replay synchronization issues and update the TODO.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
320
diff
changeset
|
521 self.handle_callbacks() |
56523a16db1d
Fix some replay synchronization issues and update the TODO.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
320
diff
changeset
|
522 |
18
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
523 self.frame += 1 |
ca26a84916cb
Add preliminary ECL viewer/interpreter.
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
524 |