4 #include "game_state.h"
10 static badge_sprite
const anim_cat
[] = {
11 { 8, 5, (uint8_t const *) "\xc7\x3f\xce\x38\x11" },
12 { 8, 5, (uint8_t const *) "\xd7\x7d\xc6\x19\x25" }
15 static badge_sprite
const anim_mushroom
[] = {
16 { 7, 7, (uint8_t const *) "\x10\x0c\x9f\xcf\xc7\x40" },
17 { 7, 7, (uint8_t const *) "\x20\x18\x1e\x8f\x87\x81" },
18 { 7, 7, (uint8_t const *) "\x10\x0c\x9f\xcf\xc7\x40" },
19 { 7, 7, (uint8_t const *) "\x08\x86\xdf\xef\x67\x20" },
20 { 7, 7, (uint8_t const *) "\x04\xc3\xef\xf7\x33\x10" },
21 { 7, 7, (uint8_t const *) "\x04\xc3\xe7\xf3\x31\x10" }
24 static badge_sprite
const anim_bunny
[] = {
25 { 7, 5, (uint8_t const *) "\x60\x30\xbe\x31\x02" },
26 { 7, 5, (uint8_t const *) "\x42\x30\xbe\x31\x01" },
27 { 7, 5, (uint8_t const *) "\x42\x30\xae\x35\x01" },
28 { 7, 5, (uint8_t const *) "\x60\x30\xae\x35\x02" },
29 { 7, 5, (uint8_t const *) "\x60\x30\xbe\x31\x01" }
32 static badge_sprite
const anim_snake
[] = {
33 { 10, 6, (uint8_t const *) "\x10\x86\x83\x30\x04\x83\xa2\x07" },
34 { 10, 6, (uint8_t const *) "\x10\x86\x83\x20\x0c\xc1\xa2\x07" },
35 { 10, 6, (uint8_t const *) "\x10\x86\x83\x20\x08\x82\xe0\x07" },
36 { 10, 6, (uint8_t const *) "\x10\x86\x83\x20\x08\x86\xe1\x07" }
39 static badge_sprite
const anim_spiral
[] = {
40 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x6f\xa1\xb5\xf6\x1a\xe8\xbf\x00\xfe\x0f" },
41 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x6f\xa1\xb5\xd6\xda\x69\xb0\x7f\x02\x0c" },
42 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x6f\xa1\xb5\xd6\x5a\x6a\xaf\x81\xfe\x0b" },
43 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x4f\x61\x35\xd5\x55\x54\x5f\x01\xfd\x07" },
44 { 10, 10, (uint8_t const *) "\xff\x07\xd0\x7f\x81\xf5\xd6\x5a\x68\xbf\x01\xfe\x0f" },
45 { 10, 10, (uint8_t const *) "\x03\xe4\xdf\x60\xb9\xb5\xd6\x5a\x68\xbf\x01\xfe\x0f" },
46 { 10, 10, (uint8_t const *) "\xfd\x17\x58\x6f\xa5\xb5\xd6\x5a\x68\xbf\x01\xfe\x0f" },
47 { 10, 10, (uint8_t const *) "\xfe\x0b\xa8\xaf\xa2\xba\xca\x6a\x28\xbf\x01\xfe\x0f" }
50 static badge_sprite
const anim_rotor
[] = {
51 { 9, 9, (uint8_t const *) "\x00\x00\x00\x00\xf0\xe1\x42\x0c\x18\x70\x00" },
52 { 9, 9, (uint8_t const *) "\x1c\x30\x60\x80\xf0\xe1\x40\x00\x00\x00\x00" },
53 { 9, 9, (uint8_t const *) "\x1c\x30\x60\x84\x0e\x1f\x00\x00\x00\x00\x00" },
54 { 9, 9, (uint8_t const *) "\x00\x00\x00\x04\x0e\x1f\x02\x0c\x18\x70\x00" }
57 static badge_sprite
const anim_dog
[] = {
58 { 8, 5, (uint8_t const *) "\xc1\xf8\xc6\xb8\x08" },
59 { 8, 5, (uint8_t const *) "\xc1\xba\xce\x99\x0c" },
60 { 8, 5, (uint8_t const *) "\xc1\xf8\xc6\xb8\x10" },
61 { 8, 5, (uint8_t const *) "\xc1\xf8\xc6\xb8\x20" }
64 static badge_sprite
const anim_giraffe
[] = {
65 { 8, 10, (uint8_t const *) "\x00\x10\x60\x80\xff\xc1\x00\x03\x3c\x08" },
66 { 8, 10, (uint8_t const *) "\x00\x10\x60\xa0\x7f\xc1\x00\x03\x1c\x88" },
67 { 9, 10, (uint8_t const *) "\x00\x10\x68\x90\x3f\xc1\x00\x03\x0c\x48\x00\x02" },
68 { 8, 10, (uint8_t const *) "\x00\x10\x60\xb0\x3f\xc1\x00\x03\x0c\xc8" },
69 { 8, 10, (uint8_t const *) "\x08\x30\xc0\x81\xfc\xc0\x00\x03\x3c\x08" },
70 { 8, 10, (uint8_t const *) "\x00\x10\x60\x80\xff\xc1\x00\x03\x3c\x08" }
73 static badge_sprite
const anim_bird
[] = {
74 { 9, 7, (uint8_t const *) "\x10\x0c\x05\xf7\x4a\xa9\x58\x10" },
75 { 9, 7, (uint8_t const *) "\x10\x0c\x05\x87\x47\xa2\x70\x10" }
77 { 10, 8, (uint8_t const *) "\x10\x10\x18\x14\x38\x2e\x29\x29\x2e\x10" },
78 { 10, 8, (uint8_t const *) "\x10\x10\x18\x14\x38\x78\xa8\xa8\x78\x10" }
82 static void enemy_animation_advance(jumpnrun_enemy
*enemy
) {
83 ++enemy
->base
.tick_minor
;
84 if(enemy
->base
.tick_minor
== enemy
->type
->animation_ticks_per_frame
) {
85 enemy
->base
.tick_minor
= 0;
87 ++enemy
->base
.anim_frame
;
88 if(enemy
->base
.anim_frame
>= enemy
->type
->animation_length
) {
89 enemy
->base
.anim_frame
= 0;
94 static void enemy_spawn(jumpnrun_enemy
*self
) {
95 // enemy unspawned, available and in spawn zone.
96 self
->base
.flags
= JUMPNRUN_ENEMY_SPAWNED
| JUMPNRUN_ENEMY_UNAVAILABLE
;
97 self
->base
.anim_frame
= 0;
98 self
->base
.tick_minor
= 0;
99 self
->base
.jumpable_frames
= 0;
102 static void jumpnrun_enemy_kill(jumpnrun_enemy
*self
) {
103 self
->base
.flags
|= JUMPNRUN_MOVEABLE_DYING
;
104 self
->base
.tick_minor
= 0;
107 void jumpnrun_enemy_despawn(jumpnrun_enemy
*self
) {
108 // Despawned enemies are reset to their spawn position, so enemy_in_spawn_area will determine whether the spawn point is in the spawn area.
109 self
->base
.flags
&= ~(JUMPNRUN_ENEMY_SPAWNED
| JUMPNRUN_ENEMY_MOVING
| JUMPNRUN_MOVEABLE_DYING
);
110 self
->base
.hitbox
= rectangle_new(self
->spawn_pos
, self
->type
->hitbox
.extent
);
111 self
->base
.inertia
= self
->type
->spawn_inertia
;
114 void jumpnrun_enemy_reset (jumpnrun_enemy
*self
) {
115 jumpnrun_enemy_despawn(self
);
116 self
->base
.flags
&= ~JUMPNRUN_ENEMY_UNAVAILABLE
;
119 static void enemy_bounce(jumpnrun_enemy
*self
) {
120 self
->base
.inertia
.x
= fixed_point_neg(self
->base
.inertia
.x
);
123 static inline vec2d
enemy_pos_hitbox (jumpnrun_enemy
const *self
) { return self
->base
.hitbox
.pos
; }
124 static inline vec2d
enemy_pos_display(jumpnrun_enemy
const *self
) { return vec2d_sub(enemy_pos_hitbox(self
), self
->type
->hitbox
.pos
); }
125 static inline vec2d
enemy_pos_desired(jumpnrun_enemy
const *self
) { return vec2d_add(enemy_pos_hitbox(self
), self
->base
.inertia
); }
127 static inline void enemy_move_to(jumpnrun_enemy
*self
, vec2d new_pos
) {
128 rectangle_move_to(&self
->base
.hitbox
, new_pos
);
131 static inline bool enemy_in_area(jumpnrun_enemy
const *self
, jumpnrun_game_state
*state
, int margin
) {
133 fixed_point_gt(rectangle_left (enemy_hitbox(self
)), FIXED_INT(jumpnrun_screen_left (state
) - margin
)) &&
134 fixed_point_lt(rectangle_right(enemy_hitbox(self
)), FIXED_INT(jumpnrun_screen_right(state
) + margin
));
137 static inline bool enemy_on_screen(jumpnrun_enemy
const *self
, jumpnrun_game_state
*state
) {
138 return enemy_in_area(self
, state
, self
->type
->animation_frames
[self
->base
.anim_frame
].width
);
141 static inline bool enemy_in_spawn_area(jumpnrun_enemy
const *self
, jumpnrun_game_state
*state
) {
142 return enemy_in_area(self
, state
, JUMPNRUN_MAX_SPAWN_MARGIN
);
145 void jumpnrun_process_enemy(jumpnrun_enemy
*self
,
146 badge_framebuffer
*fb
,
147 struct jumpnrun_game_state
*state
,
148 struct jumpnrun_level
*lv
,
149 struct jumpnrun_tile_range
const *visible_tiles
,
150 vec2d
*player_inertia_mod
) {
151 // Despawned enemies are reset to their spawn position, so enemy_in_spawn_area will determine whether the spawn point is in the spawn area.
152 if(self
->base
.flags
& JUMPNRUN_ENEMY_SPAWNED
) {
153 if(!enemy_in_spawn_area(self
, state
) || fixed_point_gt(rectangle_top (enemy_hitbox(self
)), FIXED_INT(BADGE_DISPLAY_HEIGHT
))) {
154 jumpnrun_enemy_despawn(self
);
155 } else if(self
->base
.flags
& JUMPNRUN_MOVEABLE_DYING
) {
156 if(self
->base
.tick_minor
== JUMPNRUN_SPLOSION_FRAMES
* JUMPNRUN_SPLOSION_TICKS_PER_FRAME
) {
157 jumpnrun_enemy_despawn(self
);
160 jumpnrun_render_splosion(fb
, state
, &self
->base
);
162 ++self
->base
.tick_minor
;
165 if((self
->base
.flags
& JUMPNRUN_ENEMY_MOVING
) || enemy_on_screen(self
, state
)) {
166 self
->base
.flags
|= JUMPNRUN_ENEMY_MOVING
;
168 self
->type
->move_tick(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
169 self
->type
->collision_shots(self
, state
);
170 if (fixed_point_lt(self
->base
.inertia
.x
, FIXED_INT(0))) { self
->base
.flags
&= ~JUMPNRUN_MOVEABLE_MIRRORED
; }
171 else if(fixed_point_ne(self
->base
.inertia
.x
, FIXED_INT(0))) { self
->base
.flags
|= JUMPNRUN_MOVEABLE_MIRRORED
; }
175 jumpnrun_render_enemy(fb
, state
, self
);
178 } else if(self
->base
.flags
& JUMPNRUN_ENEMY_UNAVAILABLE
) {
179 if(!enemy_in_spawn_area(self
, state
)) {
180 self
->base
.flags
&= ~JUMPNRUN_ENEMY_UNAVAILABLE
;
182 } else if(enemy_in_spawn_area(self
, state
)) {
183 // enemy unspawned, available and in spawn zone.
188 void enemy_collision_tiles_bounce_horiz(jumpnrun_enemy
*self
,
189 vec2d
*desired_position
,
191 jumpnrun_tile_range
const *visible_tiles
) {
192 vec2d inertia_mod
= self
->base
.inertia
;
194 bool killed
= collisions_tiles_displace(desired_position
,
201 jumpnrun_enemy_kill(self
);
202 } else if(fixed_point_ne(inertia_mod
.x
, self
->base
.inertia
.x
)) {
207 void enemy_collision_player_deadly(struct jumpnrun_enemy
*self
,
208 struct jumpnrun_game_state
*state
,
209 vec2d
*player_inertia_mod
) {
210 (void) player_inertia_mod
;
212 if(rectangle_intersect(enemy_hitbox(self
), &state
->player
.base
.hitbox
)) {
213 state
->player
.base
.flags
|= JUMPNRUN_PLAYER_DEAD
;
217 void enemy_collision_player_jumpable(jumpnrun_enemy
*self
,
218 jumpnrun_game_state
*state
,
219 vec2d
*player_inertia_mod
)
221 if(rectangle_intersect(enemy_hitbox(self
), &state
->player
.base
.hitbox
)) {
222 if(fixed_point_lt(rectangle_top(&state
->player
.base
.hitbox
), rectangle_top(enemy_hitbox(self
))) &&
223 fixed_point_gt(state
->player
.base
.inertia
.y
, FIXED_INT(0)))
225 jumpnrun_enemy_kill(self
);
226 player_inertia_mod
->y
= FIXED_POINT(0, -250);
227 state
->player
.base
.jumpable_frames
= 12;
229 state
->player
.base
.flags
|= JUMPNRUN_PLAYER_DEAD
;
234 void enemy_collision_tiles_pass_through(struct jumpnrun_enemy
*self
,
235 vec2d
*desired_position
,
236 struct jumpnrun_level
*lv
,
237 struct jumpnrun_tile_range
const *visible_tiles
) {
239 (void) desired_position
;
241 (void) visible_tiles
;
244 void enemy_collision_shots_die(struct jumpnrun_enemy
*self
,
245 struct jumpnrun_game_state
*state
) {
246 for(uint8_t i
= 0; i
< JUMPNRUN_MAX_SHOTS
; ++i
) {
247 jumpnrun_shot
*shot
= &state
->shots
[i
];
249 if(jumpnrun_shot_spawned(shot
)) {
250 if(rectangle_intersect(enemy_hitbox(self
), &shot
->current_box
)) {
251 jumpnrun_enemy_kill(self
);
252 jumpnrun_shot_despawn(shot
);
258 void enemy_collision_shots_bounce(struct jumpnrun_enemy
*self
,
259 struct jumpnrun_game_state
*state
) {
260 for(uint8_t i
= 0; i
< JUMPNRUN_MAX_SHOTS
; ++i
) {
261 jumpnrun_shot
*shot
= &state
->shots
[i
];
263 if(jumpnrun_shot_spawned(shot
)) {
264 if(rectangle_intersect(enemy_hitbox(self
), &shot
->current_box
)) {
265 if(fixed_point_gt(shot
->inertia
.x
, FIXED_INT(0))) {
266 rectangle_move_to_x(&shot
->current_box
, fixed_point_sub(rectangle_left(enemy_hitbox(self
)), rectangle_width(&shot
->current_box
)));
268 rectangle_move_to_x(&shot
->current_box
, rectangle_right(enemy_hitbox(self
)));
271 shot
->inertia
.x
= fixed_point_neg(shot
->inertia
.x
);
277 void enemy_collision_shots_dontcare(struct jumpnrun_enemy
*self
,
278 struct jumpnrun_game_state
*state
) {
283 static void enemy_tick_common(jumpnrun_enemy
*self
,
284 jumpnrun_game_state
*state
,
286 jumpnrun_tile_range
const *visible_tiles
,
287 vec2d
*player_inertia_mod
) {
288 vec2d new_pos
= enemy_pos_desired(self
);
289 self
->type
->collision_tiles (self
, &new_pos
, lv
, visible_tiles
);
290 self
->type
->collision_player(self
, state
, player_inertia_mod
);
291 enemy_move_to(self
, new_pos
);
294 void enemy_tick_straight_ahead(jumpnrun_enemy
*self
,
295 jumpnrun_game_state
*state
,
297 jumpnrun_tile_range
const *visible_tiles
,
298 vec2d
*player_inertia_mod
) {
299 jumpnrun_passive_movement(&self
->base
.inertia
);
300 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
301 enemy_animation_advance(self
);
304 void enemy_tick_straight_follow(jumpnrun_enemy
*self
,
305 jumpnrun_game_state
*state
,
307 jumpnrun_tile_range
const *visible_tiles
,
308 vec2d
*player_inertia_mod
) {
309 jumpnrun_passive_movement(&self
->base
.inertia
);
310 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
312 if(fixed_point_lt(rectangle_right(&state
->player
.base
.hitbox
), rectangle_left(enemy_hitbox(self
)))) {
313 self
->base
.inertia
.x
= self
->type
->spawn_inertia
.x
;
314 } else if(fixed_point_gt(rectangle_left(&state
->player
.base
.hitbox
), rectangle_right(enemy_hitbox(self
)))) {
315 self
->base
.inertia
.x
= fixed_point_neg(self
->type
->spawn_inertia
.x
);
318 enemy_animation_advance(self
);
321 void enemy_tick_swing_up_and_down(struct jumpnrun_enemy
*self
,
322 struct jumpnrun_game_state
*state
,
323 struct jumpnrun_level
*lv
,
324 struct jumpnrun_tile_range
const *visible_tiles
,
325 vec2d
*player_inertia_mod
) {
326 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
328 self
->base
.inertia
.y
=
329 fixed_point_add(fixed_point_add(self
->base
.inertia
.y
,
330 fixed_point_div(self
->type
->spawn_inertia
.y
, FIXED_INT(3))),
331 fixed_point_mul(FIXED_POINT(0, 5),
332 fixed_point_sub(self
->spawn_pos
.y
,
333 enemy_pos_display(self
).y
)));
335 enemy_animation_advance(self
);
338 void enemy_tick_stationary(struct jumpnrun_enemy
*self
,
339 struct jumpnrun_game_state
*state
,
340 struct jumpnrun_level
*lv
,
341 struct jumpnrun_tile_range
const *visible_tiles
,
342 vec2d
*player_inertia_mod
) {
343 self
->type
->collision_tiles(self
, &self
->base
.hitbox
.pos
, lv
, visible_tiles
);
344 self
->type
->collision_player(self
, state
, player_inertia_mod
);
346 enemy_animation_advance(self
);
349 void enemy_tick_jumper(jumpnrun_enemy
*self
,
350 jumpnrun_game_state
*state
,
352 jumpnrun_tile_range
const *visible_tiles
,
353 vec2d
*player_inertia_mod
) {
354 jumpnrun_passive_movement(&self
->base
.inertia
);
355 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
357 if(jumpnrun_moveable_touching_ground(&self
->base
)) {
358 self
->base
.inertia
.y
= self
->type
->spawn_inertia
.y
;
361 enemy_animation_advance(self
);
364 void enemy_tick_dog(jumpnrun_enemy
*self
,
365 jumpnrun_game_state
*state
,
367 jumpnrun_tile_range
const *visible_tiles
,
368 vec2d
*player_inertia_mod
) {
369 jumpnrun_passive_movement(&self
->base
.inertia
);
370 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
372 if(self
->base
.tick_minor
% self
->type
->animation_ticks_per_frame
== 0) {
373 switch(self
->base
.tick_minor
/ self
->type
->animation_ticks_per_frame
) {
375 self
->base
.tick_minor
= 0;
380 self
->base
.anim_frame
= 0;
381 if(self
->base
.flags
& JUMPNRUN_MOVEABLE_MIRRORED
) {
382 self
->base
.inertia
.x
= fixed_point_neg(self
->type
->spawn_inertia
.x
);
384 self
->base
.inertia
.x
= self
->type
->spawn_inertia
.x
;
393 self
->base
.anim_frame
= 1;
394 if(self
->base
.flags
& JUMPNRUN_MOVEABLE_MIRRORED
) {
395 self
->base
.inertia
.x
= fixed_point_neg(self
->type
->spawn_inertia
.x
);
397 self
->base
.inertia
.x
= self
->type
->spawn_inertia
.x
;
403 self
->base
.anim_frame
= 2;
404 self
->base
.inertia
.x
= FIXED_INT(0);
409 self
->base
.anim_frame
= 3;
410 self
->base
.inertia
.x
= FIXED_INT(0);
415 ++self
->base
.tick_minor
;
418 void enemy_tick_giraffe(jumpnrun_enemy
*self
,
419 jumpnrun_game_state
*state
,
421 jumpnrun_tile_range
const *visible_tiles
,
422 vec2d
*player_inertia_mod
) {
423 bool was_on_ground
= jumpnrun_moveable_touching_ground(&self
->base
);
425 jumpnrun_passive_movement(&self
->base
.inertia
);
426 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
428 if(jumpnrun_moveable_touching_ground(&self
->base
)) {
430 enemy_animation_advance(self
);
431 if(self
->base
.anim_frame
== 0) {
432 self
->base
.inertia
= self
->type
->spawn_inertia
;
434 if(fixed_point_gt(rectangle_mid_x(&state
->player
.base
.hitbox
), rectangle_mid_x(enemy_hitbox(self
)))) {
435 self
->base
.inertia
.x
= fixed_point_neg(self
->base
.inertia
.x
);
439 self
->base
.tick_minor
= 0;
440 self
->base
.anim_frame
= 3;
441 self
->base
.inertia
.x
= FIXED_INT(0);
443 } else if(was_on_ground
) {
444 self
->base
.tick_minor
= 0;
445 self
->base
.anim_frame
= 1;
446 } else if(self
->base
.anim_frame
== 1) {
447 enemy_animation_advance(self
);
450 ++self
->base
.tick_minor
;
453 void enemy_tick_fly_straight(struct jumpnrun_enemy
*self
,
454 struct jumpnrun_game_state
*state
,
455 struct jumpnrun_level
*lv
,
456 struct jumpnrun_tile_range
const *visible_tiles
,
457 vec2d
*player_inertia_mod
) {
458 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
459 enemy_animation_advance(self
);
462 void enemy_tick_fly_straight_and_dip(struct jumpnrun_enemy
*self
,
463 struct jumpnrun_game_state
*state
,
464 struct jumpnrun_level
*lv
,
465 struct jumpnrun_tile_range
const *visible_tiles
,
466 vec2d
*player_inertia_mod
) {
467 if(fixed_point_lt(fixed_point_abs(fixed_point_sub(enemy_pos_hitbox(self
).x
,
468 state
->player
.base
.hitbox
.pos
.x
)),
470 self
->base
.flags
|= JUMPNRUN_ENEMY_EVENT_TRIGGER1
;
473 if(self
->base
.flags
& JUMPNRUN_ENEMY_EVENT_TRIGGER1
) {
474 self
->base
.inertia
.y
=
475 fixed_point_add(fixed_point_add(self
->base
.inertia
.y
,
476 fixed_point_div(self
->type
->spawn_inertia
.y
, FIXED_INT(3))),
477 fixed_point_mul(FIXED_POINT(0, 5),
478 fixed_point_sub(self
->spawn_pos
.y
,
479 enemy_pos_hitbox(self
).y
)));
481 self
->base
.inertia
.y
= FIXED_INT(0);
484 enemy_tick_common(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
485 enemy_animation_advance(self
);
488 jumpnrun_enemy_type
const jumpnrun_enemy_type_data
[JUMPNRUN_ENEMY_TYPE_COUNT
] = {
490 .animation_ticks_per_frame
= 18,
491 .animation_length
= ARRAY_SIZE(anim_cat
),
492 .animation_frames
= anim_cat
,
493 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(2) },
494 { FIXED_INT_I(6), FIXED_INT_I(3) } },
495 .spawn_inertia
= { FIXED_POINT_I(0, -200), FIXED_INT_I(0) },
496 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
497 .collision_player
= enemy_collision_player_jumpable
,
498 .collision_shots
= enemy_collision_shots_die
,
499 .move_tick
= enemy_tick_straight_ahead
501 .animation_ticks_per_frame
= 12,
502 .animation_length
= ARRAY_SIZE(anim_mushroom
),
503 .animation_frames
= anim_mushroom
,
504 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
505 { FIXED_INT_I(5), FIXED_INT_I(6) } },
506 .spawn_inertia
= { FIXED_POINT_I(0, -80), FIXED_INT_I(0) },
507 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
508 .collision_player
= enemy_collision_player_jumpable
,
509 .collision_shots
= enemy_collision_shots_die
,
510 .move_tick
= enemy_tick_straight_follow
512 .animation_ticks_per_frame
= 9,
513 .animation_length
= ARRAY_SIZE(anim_bunny
),
514 .animation_frames
= anim_bunny
,
515 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(2) },
516 { FIXED_INT_I(5), FIXED_INT_I(3) } },
517 .spawn_inertia
= { FIXED_POINT_I(0, -80), FIXED_POINT_I(0, -800) },
518 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
519 .collision_player
= enemy_collision_player_jumpable
,
520 .collision_shots
= enemy_collision_shots_die
,
521 .move_tick
= enemy_tick_jumper
523 .animation_ticks_per_frame
= 6,
524 .animation_length
= ARRAY_SIZE(anim_snake
),
525 .animation_frames
= anim_snake
,
526 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(4) },
527 { FIXED_INT_I(8), FIXED_INT_I(2) } },
528 .spawn_inertia
= { FIXED_POINT_I(0, -150), FIXED_INT_I(0) },
529 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
530 .collision_player
= enemy_collision_player_jumpable
,
531 .collision_shots
= enemy_collision_shots_die
,
532 .move_tick
= enemy_tick_straight_ahead
534 .animation_ticks_per_frame
= 6,
535 .animation_length
= ARRAY_SIZE(anim_spiral
),
536 .animation_frames
= anim_spiral
,
537 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
538 { FIXED_INT_I(8), FIXED_INT_I(8) } },
539 .spawn_inertia
= { FIXED_INT_I(0), FIXED_POINT_I(0, -200) },
540 .collision_tiles
= enemy_collision_tiles_pass_through
,
541 .collision_player
= enemy_collision_player_deadly
,
542 .collision_shots
= enemy_collision_shots_dontcare
,
543 .move_tick
= enemy_tick_swing_up_and_down
545 .animation_ticks_per_frame
= 5,
546 .animation_length
= ARRAY_SIZE(anim_rotor
),
547 .animation_frames
= anim_rotor
,
548 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
549 { FIXED_INT_I(7), FIXED_INT_I(7) } },
550 .spawn_inertia
= { FIXED_INT_I(0), FIXED_POINT_I(0, 0) },
551 .collision_tiles
= enemy_collision_tiles_pass_through
,
552 .collision_player
= enemy_collision_player_deadly
,
553 .collision_shots
= enemy_collision_shots_dontcare
,
554 .move_tick
= enemy_tick_stationary
556 .animation_ticks_per_frame
= 18,
557 .animation_length
= ARRAY_SIZE(anim_dog
),
558 .animation_frames
= anim_dog
,
559 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
560 { FIXED_INT_I(6), FIXED_INT_I(4) } },
561 .spawn_inertia
= { FIXED_POINT_I(0, -200), FIXED_POINT_I(0, 0) },
562 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
563 .collision_player
= enemy_collision_player_jumpable
,
564 .collision_shots
= enemy_collision_shots_die
,
565 .move_tick
= enemy_tick_dog
567 .animation_ticks_per_frame
= 36,
568 .animation_length
= ARRAY_SIZE(anim_giraffe
),
569 .animation_frames
= anim_giraffe
,
570 .hitbox
= { { FIXED_INT_I(2), FIXED_INT_I(1) },
571 { FIXED_INT_I(4), FIXED_INT_I(9) } },
572 .spawn_inertia
= { FIXED_POINT_I(0, -150), FIXED_POINT_I(-1, -200) },
573 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
574 .collision_player
= enemy_collision_player_jumpable
,
575 .collision_shots
= enemy_collision_shots_bounce
,
576 .move_tick
= enemy_tick_giraffe
578 .animation_ticks_per_frame
= 24,
579 .animation_length
= ARRAY_SIZE(anim_bird
),
580 .animation_frames
= anim_bird
,
581 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(3) },
582 { FIXED_INT_I(7), FIXED_INT_I(3) } },
583 .spawn_inertia
= { FIXED_POINT_I(0, -400), FIXED_POINT_I(0, -150) },
584 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
585 .collision_player
= enemy_collision_player_jumpable
,
586 .collision_shots
= enemy_collision_shots_die
,
587 .move_tick
= enemy_tick_swing_up_and_down
589 .animation_ticks_per_frame
= 24,
590 .animation_length
= ARRAY_SIZE(anim_bird
),
591 .animation_frames
= anim_bird
,
592 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(3) },
593 { FIXED_INT_I(7), FIXED_INT_I(3) } },
594 .spawn_inertia
= { FIXED_POINT_I(0, -400), FIXED_INT_I(0) },
595 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
596 .collision_player
= enemy_collision_player_jumpable
,
597 .collision_shots
= enemy_collision_shots_die
,
598 .move_tick
= enemy_tick_fly_straight
600 .animation_ticks_per_frame
= 24,
601 .animation_length
= ARRAY_SIZE(anim_bird
),
602 .animation_frames
= anim_bird
,
603 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(3) },
604 { FIXED_INT_I(7), FIXED_INT_I(3) } },
605 .spawn_inertia
= { FIXED_POINT_I(0, -400), FIXED_POINT_I(0, 200) },
606 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
607 .collision_player
= enemy_collision_player_jumpable
,
608 .collision_shots
= enemy_collision_shots_die
,
609 .move_tick
= enemy_tick_fly_straight_and_dip