annotate pytouhou/game/enemy.pxd @ 667:904849807fd8

Implement update_mode 1 on enemy.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 12 Aug 2019 15:09:34 +0200 (2019-08-12)
parents a6af3ff86612
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 from pytouhou.game.element cimport Element
447
78e1c3864e73 Make pytouhou.game.game an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 441
diff changeset
2 from pytouhou.game.game cimport Game
468
feecdb4a8928 Add “except *” to cdef void functions, and type some more.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 447
diff changeset
3 from pytouhou.game.player cimport Player
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4 from pytouhou.utils.interpolator cimport Interpolator
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
5
497
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
6 cdef class Callback:
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
7 cdef function
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
8 cdef public tuple args # XXX: public only for ECL’s copy_callbacks.
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
9
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
10 cpdef enable(self, function, tuple args)
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
11 cpdef disable(self)
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
12 cpdef fire(self)
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
13
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
14 cdef class Enemy(Element):
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
15 cdef public double z, angle, speed, rotation_speed, acceleration
497
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
16 cdef public long _type, bonus_dropped, die_score, frame, life, death_flags, current_laser_id, low_life_trigger, timeout, remaining_lives, bullet_launch_interval, bullet_launch_timer, death_anim, direction, update_mode
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
17 cdef public bint visible, was_visible, touchable, collidable, damageable, boss, automatic_orientation, delay_attack
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
18 cdef public tuple difficulty_coeffs, extended_bullet_attributes, bullet_attributes, bullet_launch_offset, movement_dependant_sprites, screen_box
497
3da7395f39e3 Make enemy callbacks programmables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 468
diff changeset
19 cdef public Callback death_callback, boss_callback, low_life_callback, timeout_callback
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
20 cdef public dict laser_by_id
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
21 cdef public list aux_anm
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
22 cdef public Interpolator interpolator, speed_interpolator
447
78e1c3864e73 Make pytouhou.game.game an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 441
diff changeset
23 cdef public object _anms, process
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
24
447
78e1c3864e73 Make pytouhou.game.game an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 441
diff changeset
25 cdef Game _game
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
26 cdef double[2] hitbox_half_size
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
27
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
28 cpdef play_sound(self, index)
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
29 cpdef set_hitbox(self, double width, double height)
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
30 cpdef set_bullet_attributes(self, type_, anim, sprite_idx_offset,
509
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
31 unsigned long bullets_per_shot,
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
32 unsigned long number_of_shots, double speed,
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
33 double speed2, launch_angle, angle, flags)
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
34 cpdef set_bullet_launch_interval(self, long value, unsigned long start=*)
509
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
35 cpdef fire(self, offset=*, bullet_attributes=*, tuple launch_pos=*)
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
36 cpdef new_laser(self, unsigned long variant, laser_type, sprite_idx_offset,
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
37 double angle, speed, start_offset, end_offset, max_length,
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
38 width, start_duration, duration, end_duration,
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
39 grazing_delay, grazing_extra_duration, unknown,
509
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
40 tuple offset=*)
468
feecdb4a8928 Add “except *” to cdef void functions, and type some more.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 447
diff changeset
41 cpdef Player select_player(self, list players=*)
564
a0fa01cd9f70 Make Enemy.get_angle able to target any Element, not only Player.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 545
diff changeset
42 cpdef double get_angle(self, Element target, tuple pos=*) except 42
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
43 cpdef set_anim(self, index)
617
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 606
diff changeset
44 cdef bint die_anim(self) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 606
diff changeset
45 cdef bint drop_particles(self, long number, long color) except True
441
e8dc95a2a287 Make pytouhou.game.enemy an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
46 cpdef set_aux_anm(self, long number, long index)
509
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
47 cpdef set_pos(self, double x, double y, double z)
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
48 cpdef move_to(self, unsigned long duration, double x, double y, double z, formula)
292fea5c584e Some more type optimisations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 497
diff changeset
49 cpdef stop_in(self, unsigned long duration, formula)
545
bcff39c920ab Set boss mode directly from the enemy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 509
diff changeset
50 cpdef set_boss(self, bint enable)
606
3c2f96f1d715 Fix compilation under Cython 0.22, by making the pyx and the pxd declarations’ except clause similar.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 564
diff changeset
51 cdef bint is_visible(self, long screen_width, long screen_height) except -1
617
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 606
diff changeset
52 cdef bint check_collisions(self) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 606
diff changeset
53 cdef bint handle_callbacks(self) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 606
diff changeset
54 cdef bint update(self) except True