7 static badge_sprite
const anim_cat
[] = {
8 { 8, 5, (uint8_t const *) "\xc7\x3f\xce\x38\x11" },
9 { 8, 5, (uint8_t const *) "\xd7\x7d\xc6\x19\x25" }
12 static badge_sprite
const anim_mushroom
[] = {
13 { 7, 7, (uint8_t const *) "\x10\x0c\x9f\xcf\xc7\x40" },
14 { 7, 7, (uint8_t const *) "\x20\x18\x1e\x8f\x87\x81" },
15 { 7, 7, (uint8_t const *) "\x10\x0c\x9f\xcf\xc7\x40" },
16 { 7, 7, (uint8_t const *) "\x08\x86\xdf\xef\x67\x20" },
17 { 7, 7, (uint8_t const *) "\x04\xc3\xef\xf7\x33\x10" },
18 { 7, 7, (uint8_t const *) "\x04\xc3\xe7\xf3\x31\x10" }
21 static badge_sprite
const anim_bunny
[] = {
22 { 7, 5, (uint8_t const *) "\x60\x30\xbe\x31\x02" },
23 { 7, 5, (uint8_t const *) "\x42\x30\xbe\x31\x01" },
24 { 7, 5, (uint8_t const *) "\x42\x30\xae\x35\x01" },
25 { 7, 5, (uint8_t const *) "\x60\x30\xae\x35\x02" },
26 { 7, 5, (uint8_t const *) "\x60\x30\xbe\x31\x01" }
29 static badge_sprite
const anim_snake
[] = {
30 { 10, 6, (uint8_t const *) "\x10\x86\x83\x30\x04\x83\xa2\x07" },
31 { 10, 6, (uint8_t const *) "\x10\x86\x83\x20\x0c\xc1\xa2\x07" },
32 { 10, 6, (uint8_t const *) "\x10\x86\x83\x20\x08\x82\xe0\x07" },
33 { 10, 6, (uint8_t const *) "\x10\x86\x83\x20\x08\x86\xe1\x07" }
36 static badge_sprite
const anim_spiral
[] = {
37 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x6f\xa1\xb5\xf6\x1a\xe8\xbf\x00\xfe\x0f" },
38 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x6f\xa1\xb5\xd6\xda\x69\xb0\x7f\x02\x0c" },
39 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x6f\xa1\xb5\xd6\x5a\x6a\xaf\x81\xfe\x0b" },
40 { 10, 10, (uint8_t const *) "\xff\x07\xd8\x4f\x61\x35\xd5\x55\x54\x5f\x01\xfd\x07" },
41 { 10, 10, (uint8_t const *) "\xff\x07\xd0\x7f\x81\xf5\xd6\x5a\x68\xbf\x01\xfe\x0f" },
42 { 10, 10, (uint8_t const *) "\x03\xe4\xdf\x60\xb9\xb5\xd6\x5a\x68\xbf\x01\xfe\x0f" },
43 { 10, 10, (uint8_t const *) "\xfd\x17\x58\x6f\xa5\xb5\xd6\x5a\x68\xbf\x01\xfe\x0f" },
44 { 10, 10, (uint8_t const *) "\xfe\x0b\xa8\xaf\xa2\xba\xca\x6a\x28\xbf\x01\xfe\x0f" }
47 static badge_sprite
const anim_rotor
[] = {
48 { 9, 9, (uint8_t const *) "\x00\x00\x00\x00\xf0\xe1\x42\x0c\x18\x70\x00" },
49 { 9, 9, (uint8_t const *) "\x1c\x30\x60\x80\xf0\xe1\x40\x00\x00\x00\x00" },
50 { 9, 9, (uint8_t const *) "\x1c\x30\x60\x84\x0e\x1f\x00\x00\x00\x00\x00" },
51 { 9, 9, (uint8_t const *) "\x00\x00\x00\x04\x0e\x1f\x02\x0c\x18\x70\x00" }
54 static badge_sprite
const anim_dog
[] = {
55 { 8, 5, (uint8_t const *) "\xc1\xf8\xc6\xb8\x08" },
56 { 8, 5, (uint8_t const *) "\xc1\xba\xce\x99\x0c" },
57 { 8, 5, (uint8_t const *) "\xc1\xf8\xc6\xb8\x10" },
58 { 8, 5, (uint8_t const *) "\xc1\xf8\xc6\xb8\x20" }
61 static badge_sprite
const anim_giraffe
[] = {
62 { 8, 10, (uint8_t const *) "\x00\x10\x60\x80\xff\xc1\x00\x03\x3c\x08" },
63 { 8, 10, (uint8_t const *) "\x00\x10\x60\xa0\x7f\xc1\x00\x03\x1c\x88" },
64 { 9, 10, (uint8_t const *) "\x00\x10\x68\x90\x3f\xc1\x00\x03\x0c\x48\x00\x02" },
65 { 8, 10, (uint8_t const *) "\x00\x10\x60\xb0\x3f\xc1\x00\x03\x0c\xc8" },
66 { 8, 10, (uint8_t const *) "\x08\x30\xc0\x81\xfc\xc0\x00\x03\x3c\x08" },
67 { 8, 10, (uint8_t const *) "\x00\x10\x60\x80\xff\xc1\x00\x03\x3c\x08" }
70 static badge_sprite
const anim_bird
[] = {
71 { 10, 8, (uint8_t const *) "\x10\x10\x18\x14\x38\x2e\x29\x29\x2e\x10" },
72 { 10, 8, (uint8_t const *) "\x10\x10\x18\x14\x38\x78\xa8\xa8\x78\x10" }
75 static void enemy_animation_advance(jumpnrun_enemy
*enemy
) {
76 ++enemy
->base
.tick_minor
;
77 if(enemy
->base
.tick_minor
== enemy
->type
->animation_ticks_per_frame
) {
78 enemy
->base
.tick_minor
= 0;
80 ++enemy
->base
.anim_frame
;
81 if(enemy
->base
.anim_frame
>= enemy
->type
->animation_length
) {
82 enemy
->base
.anim_frame
= 0;
87 void jumpnrun_process_enemy(jumpnrun_enemy
*self
,
88 badge_framebuffer
*fb
,
89 struct jumpnrun_game_state
*state
,
90 struct jumpnrun_level
*lv
,
91 struct jumpnrun_tile_range
const *visible_tiles
,
92 vec2d
*player_inertia_mod
) {
93 int const spawn_margin
= 1 + self
->type
->animation_frames
[self
->base
.anim_frame
].width
;
95 if(self
->flags
& JUMPNRUN_ENEMY_SPAWNED
) {
96 if(fixed_point_lt(rectangle_left(enemy_box(self
)), FIXED_POINT(state
->left
- spawn_margin
, 0)) ||
97 fixed_point_gt(rectangle_left(enemy_box(self
)), FIXED_POINT(state
->left
+ BADGE_DISPLAY_WIDTH
+ spawn_margin
, 0)) ||
98 fixed_point_gt(rectangle_top (enemy_box(self
)), FIXED_POINT(BADGE_DISPLAY_HEIGHT
, 0))) {
99 self
->flags
&= ~JUMPNRUN_ENEMY_SPAWNED
;
101 self
->type
->game_tick(self
, state
, lv
, visible_tiles
, player_inertia_mod
);
104 badge_framebuffer_blt(fb
,
105 fixed_point_cast_int(rectangle_left(enemy_box(self
))) - state
->left
,
106 fixed_point_cast_int(rectangle_top (enemy_box(self
))),
108 enemy_render_flags(self
));
111 } else if(self
->flags
& JUMPNRUN_ENEMY_UNAVAILABLE
) {
112 if(state
->left
> fixed_point_cast_int(self
->spawn_pos
.x
) + spawn_margin
||
113 state
->left
+ BADGE_DISPLAY_WIDTH
+ spawn_margin
< fixed_point_cast_int(self
->spawn_pos
.x
)) {
114 self
->flags
&= ~JUMPNRUN_ENEMY_UNAVAILABLE
;
116 } else if((fixed_point_gt(self
->spawn_pos
.x
, FIXED_POINT(state
->left
- spawn_margin
, 0)) &&
117 fixed_point_lt(self
->spawn_pos
.x
, FIXED_POINT(state
->left
- spawn_margin
/ 2, 0))) ||
118 (fixed_point_lt(self
->spawn_pos
.x
, FIXED_POINT(state
->left
+ BADGE_DISPLAY_WIDTH
+ spawn_margin
, 0)) &&
119 fixed_point_gt(self
->spawn_pos
.x
, FIXED_POINT(state
->left
+ BADGE_DISPLAY_WIDTH
, 0)))) {
120 // enemy unspawned, available and in spawn zone.
121 self
->flags
|= JUMPNRUN_ENEMY_SPAWNED
| JUMPNRUN_ENEMY_UNAVAILABLE
;
122 self
->base
.current_box
= rectangle_new(self
->spawn_pos
, self
->type
->extent
);
123 self
->base
.inertia
= self
->type
->spawn_inertia
;
124 self
->base
.anim_frame
= 0;
125 self
->base
.tick_minor
= 0;
126 self
->base
.touching_ground
= false;
127 self
->base
.jumpable_frames
= 0;
131 void enemy_collision_tiles_bounce_horiz(jumpnrun_enemy
*self
,
132 vec2d
*desired_position
,
134 jumpnrun_tile_range
const *visible_tiles
) {
135 vec2d inertia_mod
= self
->base
.inertia
;
137 collisions_tiles_displace(desired_position
,
143 if(fixed_point_ne(inertia_mod
.x
, self
->base
.inertia
.x
)) {
144 self
->base
.inertia
.x
= fixed_point_neg(self
->base
.inertia
.x
);
148 void enemy_collision_player_deadly(struct jumpnrun_enemy
*self
,
149 struct jumpnrun_game_state
*state
,
150 vec2d
*player_inertia_mod
) {
151 (void) player_inertia_mod
;
153 rectangle rect_self
= enemy_hitbox(self
);
155 if(rectangle_intersect(&rect_self
, &state
->player
.current_box
)) {
156 state
->status
= JUMPNRUN_DEAD
;
160 void enemy_collision_player_jumpable(jumpnrun_enemy
*self
,
161 jumpnrun_game_state
*state
,
162 vec2d
*player_inertia_mod
)
164 rectangle rect_self
= enemy_hitbox(self
);
166 if(rectangle_intersect(&rect_self
, &state
->player
.current_box
)) {
167 if(fixed_point_gt(state
->player
.inertia
.y
, FIXED_POINT(0, 0))) {
168 self
->flags
&= ~JUMPNRUN_ENEMY_SPAWNED
;
169 player_inertia_mod
->y
= FIXED_POINT(0, -250);
170 state
->player
.jumpable_frames
= 12;
172 state
->status
= JUMPNRUN_DEAD
;
177 void enemy_collision_tiles_pass_through(struct jumpnrun_enemy
*self
,
178 vec2d
*desired_position
,
179 struct jumpnrun_level
*lv
,
180 struct jumpnrun_tile_range
const *visible_tiles
) {
182 (void) desired_position
;
184 (void) visible_tiles
;
188 void enemy_tick_straight_ahead(jumpnrun_enemy
*self
,
189 jumpnrun_game_state
*state
,
191 jumpnrun_tile_range
const *visible_tiles
,
192 vec2d
*player_inertia_mod
) {
193 int screenpos
= fixed_point_cast_int(rectangle_left(&self
->base
.current_box
));
195 if(screenpos
+ JUMPNRUN_MAX_SPAWN_MARGIN
< state
->left
||
196 screenpos
>= state
->left
+ BADGE_DISPLAY_WIDTH
+ JUMPNRUN_MAX_SPAWN_MARGIN
) {
200 jumpnrun_passive_movement(&self
->base
.inertia
);
202 vec2d new_pos
= vec2d_add(enemy_position(self
), self
->base
.inertia
);
203 self
->type
->collision_tiles(self
, &new_pos
, lv
, visible_tiles
);
204 self
->type
->collision_player(self
, state
, player_inertia_mod
);
205 rectangle_move_to(&self
->base
.current_box
, new_pos
);
207 enemy_animation_advance(self
);
210 void enemy_tick_swing_up_and_down(struct jumpnrun_enemy
*self
,
211 struct jumpnrun_game_state
*state
,
212 struct jumpnrun_level
*lv
,
213 struct jumpnrun_tile_range
const *visible_tiles
,
214 vec2d
*player_inertia_mod
) {
215 int screenpos
= fixed_point_cast_int(rectangle_left(&self
->base
.current_box
));
217 if(screenpos
+ JUMPNRUN_MAX_SPAWN_MARGIN
< state
->left
||
218 screenpos
>= state
->left
+ BADGE_DISPLAY_WIDTH
+ JUMPNRUN_MAX_SPAWN_MARGIN
) {
222 vec2d new_pos
= vec2d_add(enemy_position(self
), self
->base
.inertia
);
223 self
->type
->collision_tiles(self
, &new_pos
, lv
, visible_tiles
);
224 self
->type
->collision_player(self
, state
, player_inertia_mod
);
225 rectangle_move_to(&self
->base
.current_box
, new_pos
);
227 self
->base
.inertia
.y
=
228 fixed_point_add(fixed_point_add(self
->base
.inertia
.y
,
229 fixed_point_div(self
->type
->spawn_inertia
.y
, FIXED_INT(3))),
230 fixed_point_mul(FIXED_POINT(0, 5),
231 fixed_point_sub(self
->spawn_pos
.y
,
232 enemy_position(self
).y
)));
234 enemy_animation_advance(self
);
237 void enemy_tick_stationary(struct jumpnrun_enemy
*self
,
238 struct jumpnrun_game_state
*state
,
239 struct jumpnrun_level
*lv
,
240 struct jumpnrun_tile_range
const *visible_tiles
,
241 vec2d
*player_inertia_mod
) {
242 int screenpos
= fixed_point_cast_int(rectangle_left(&self
->base
.current_box
));
244 if(screenpos
+ JUMPNRUN_MAX_SPAWN_MARGIN
< state
->left
||
245 screenpos
>= state
->left
+ BADGE_DISPLAY_WIDTH
+ JUMPNRUN_MAX_SPAWN_MARGIN
) {
249 self
->type
->collision_tiles(self
, &self
->base
.current_box
.pos
, lv
, visible_tiles
);
250 self
->type
->collision_player(self
, state
, player_inertia_mod
);
252 enemy_animation_advance(self
);
255 void enemy_tick_jumper(jumpnrun_enemy
*self
,
256 jumpnrun_game_state
*state
,
258 jumpnrun_tile_range
const *visible_tiles
,
259 vec2d
*player_inertia_mod
) {
260 int screenpos
= fixed_point_cast_int(rectangle_left(&self
->base
.current_box
));
262 if(screenpos
+ JUMPNRUN_MAX_SPAWN_MARGIN
< state
->left
||
263 screenpos
>= state
->left
+ BADGE_DISPLAY_WIDTH
+ JUMPNRUN_MAX_SPAWN_MARGIN
) {
267 jumpnrun_passive_movement(&self
->base
.inertia
);
269 vec2d new_pos
= vec2d_add(enemy_position(self
), self
->base
.inertia
);
270 self
->type
->collision_tiles(self
, &new_pos
, lv
, visible_tiles
);
271 self
->type
->collision_player(self
, state
, player_inertia_mod
);
272 rectangle_move_to(&self
->base
.current_box
, new_pos
);
274 if(self
->base
.touching_ground
) {
275 self
->base
.inertia
.y
= self
->type
->spawn_inertia
.y
;
278 enemy_animation_advance(self
);
281 void enemy_tick_dog(jumpnrun_enemy
*self
,
282 jumpnrun_game_state
*state
,
284 jumpnrun_tile_range
const *visible_tiles
,
285 vec2d
*player_inertia_mod
) {
286 int screenpos
= fixed_point_cast_int(rectangle_left(&self
->base
.current_box
));
288 if(screenpos
+ JUMPNRUN_MAX_SPAWN_MARGIN
< state
->left
||
289 screenpos
>= state
->left
+ BADGE_DISPLAY_WIDTH
+ JUMPNRUN_MAX_SPAWN_MARGIN
) {
293 jumpnrun_passive_movement(&self
->base
.inertia
);
295 vec2d new_pos
= vec2d_add(enemy_position(self
), self
->base
.inertia
);
296 self
->type
->collision_tiles(self
, &new_pos
, lv
, visible_tiles
);
297 self
->type
->collision_player(self
, state
, player_inertia_mod
);
298 rectangle_move_to(&self
->base
.current_box
, new_pos
);
300 if(self
->base
.tick_minor
% self
->type
->animation_ticks_per_frame
== 0) {
301 switch(self
->base
.tick_minor
/ self
->type
->animation_ticks_per_frame
) {
303 self
->base
.tick_minor
= 0;
308 self
->base
.anim_frame
= 0;
309 if(self
->flags
& JUMPNRUN_ENEMY_FACING_RIGHT
) {
310 self
->base
.inertia
.x
= fixed_point_neg(self
->type
->spawn_inertia
.x
);
312 self
->base
.inertia
.x
= self
->type
->spawn_inertia
.x
;
321 self
->base
.anim_frame
= 1;
322 if(self
->flags
& JUMPNRUN_ENEMY_FACING_RIGHT
) {
323 self
->base
.inertia
.x
= fixed_point_neg(self
->type
->spawn_inertia
.x
);
325 self
->base
.inertia
.x
= self
->type
->spawn_inertia
.x
;
331 self
->base
.anim_frame
= 2;
332 self
->base
.inertia
.x
= FIXED_INT(0);
337 self
->base
.anim_frame
= 3;
338 self
->base
.inertia
.x
= FIXED_INT(0);
343 ++self
->base
.tick_minor
;
344 if (fixed_point_lt(self
->base
.inertia
.x
, FIXED_INT(0))) { self
->flags
&= ~JUMPNRUN_ENEMY_FACING_RIGHT
; }
345 else if(fixed_point_ne(self
->base
.inertia
.x
, FIXED_INT(0))) { self
->flags
|= JUMPNRUN_ENEMY_FACING_RIGHT
; }
348 void enemy_tick_giraffe(jumpnrun_enemy
*self
,
349 jumpnrun_game_state
*state
,
351 jumpnrun_tile_range
const *visible_tiles
,
352 vec2d
*player_inertia_mod
) {
353 int screenpos
= fixed_point_cast_int(rectangle_left(&self
->base
.current_box
));
355 if(screenpos
+ JUMPNRUN_MAX_SPAWN_MARGIN
< state
->left
||
356 screenpos
>= state
->left
+ BADGE_DISPLAY_WIDTH
+ JUMPNRUN_MAX_SPAWN_MARGIN
) {
360 bool was_on_ground
= self
->base
.touching_ground
;
362 jumpnrun_passive_movement(&self
->base
.inertia
);
364 vec2d new_pos
= vec2d_add(enemy_position(self
), self
->base
.inertia
);
365 self
->type
->collision_tiles(self
, &new_pos
, lv
, visible_tiles
);
366 self
->type
->collision_player(self
, state
, player_inertia_mod
);
367 rectangle_move_to(&self
->base
.current_box
, new_pos
);
369 if(self
->base
.touching_ground
) {
371 enemy_animation_advance(self
);
372 if(self
->base
.anim_frame
== 0) {
373 if(self
->flags
& JUMPNRUN_ENEMY_FACING_RIGHT
) {
374 self
->base
.inertia
.x
= fixed_point_neg(self
->type
->spawn_inertia
.x
);
375 self
->base
.inertia
.y
= self
->type
->spawn_inertia
.y
;
377 self
->base
.inertia
= self
->type
->spawn_inertia
;
381 self
->base
.tick_minor
= 0;
382 self
->base
.anim_frame
= 3;
383 self
->base
.inertia
.x
= FIXED_INT(0);
385 } else if(was_on_ground
) {
386 self
->base
.tick_minor
= 0;
387 self
->base
.anim_frame
= 1;
388 } else if(self
->base
.anim_frame
== 1) {
389 enemy_animation_advance(self
);
392 ++self
->base
.tick_minor
;
393 if (fixed_point_lt(self
->base
.inertia
.x
, FIXED_INT(0))) { self
->flags
&= ~JUMPNRUN_ENEMY_FACING_RIGHT
; }
394 else if(fixed_point_ne(self
->base
.inertia
.x
, FIXED_INT(0))) { self
->flags
|= JUMPNRUN_ENEMY_FACING_RIGHT
; }
397 jumpnrun_enemy_type
const jumpnrun_enemy_type_data
[JUMPNRUN_ENEMY_TYPE_COUNT
] = {
399 .animation_ticks_per_frame
= 18,
400 .animation_length
= ARRAY_SIZE(anim_cat
),
401 .animation_frames
= anim_cat
,
402 .extent
= { FIXED_INT_I(8), FIXED_INT_I(5) },
403 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(2) },
404 { FIXED_INT_I(6), FIXED_INT_I(3) } },
405 .spawn_inertia
= { FIXED_POINT_I(0, -200), FIXED_INT_I(0) },
406 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
407 .collision_player
= enemy_collision_player_jumpable
,
408 .game_tick
= enemy_tick_straight_ahead
410 .animation_ticks_per_frame
= 12,
411 .animation_length
= ARRAY_SIZE(anim_mushroom
),
412 .animation_frames
= anim_mushroom
,
413 .extent
= { FIXED_INT_I(7), FIXED_INT_I(7) },
414 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
415 { FIXED_INT_I(5), FIXED_INT_I(4) } },
416 .spawn_inertia
= { FIXED_POINT_I(0, -50), FIXED_INT_I(0) },
417 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
418 .collision_player
= enemy_collision_player_jumpable
,
419 .game_tick
= enemy_tick_straight_ahead
421 .animation_ticks_per_frame
= 9,
422 .animation_length
= ARRAY_SIZE(anim_bunny
),
423 .animation_frames
= anim_bunny
,
424 .extent
= { FIXED_INT_I(7), FIXED_INT_I(5) },
425 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(2) },
426 { FIXED_INT_I(5), FIXED_INT_I(3) } },
427 .spawn_inertia
= { FIXED_POINT_I(0, -80), FIXED_POINT_I(0, -800) },
428 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
429 .collision_player
= enemy_collision_player_jumpable
,
430 .game_tick
= enemy_tick_jumper
432 .animation_ticks_per_frame
= 6,
433 .animation_length
= ARRAY_SIZE(anim_snake
),
434 .animation_frames
= anim_snake
,
435 .extent
= { FIXED_INT_I(10), FIXED_INT_I(6) },
436 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(4) },
437 { FIXED_INT_I(8), FIXED_INT_I(2) } },
438 .spawn_inertia
= { FIXED_POINT_I(0, -150), FIXED_INT_I(0) },
439 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
440 .collision_player
= enemy_collision_player_jumpable
,
441 .game_tick
= enemy_tick_straight_ahead
443 .animation_ticks_per_frame
= 6,
444 .animation_length
= ARRAY_SIZE(anim_spiral
),
445 .animation_frames
= anim_spiral
,
446 .extent
= { FIXED_INT_I(10), FIXED_INT_I(10) },
447 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
448 { FIXED_INT_I(8), FIXED_INT_I(8) } },
449 .spawn_inertia
= { FIXED_INT_I(0), FIXED_POINT_I(0, -200) },
450 .collision_tiles
= enemy_collision_tiles_pass_through
,
451 .collision_player
= enemy_collision_player_deadly
,
452 .game_tick
= enemy_tick_swing_up_and_down
454 .animation_ticks_per_frame
= 5,
455 .animation_length
= ARRAY_SIZE(anim_rotor
),
456 .animation_frames
= anim_rotor
,
457 .extent
= { FIXED_INT_I(9), FIXED_INT_I(9) },
458 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
459 { FIXED_INT_I(7), FIXED_INT_I(7) } },
460 .spawn_inertia
= { FIXED_INT_I(0), FIXED_POINT_I(0, 0) },
461 .collision_tiles
= enemy_collision_tiles_pass_through
,
462 .collision_player
= enemy_collision_player_deadly
,
463 .game_tick
= enemy_tick_stationary
465 .animation_ticks_per_frame
= 18,
466 .animation_length
= ARRAY_SIZE(anim_dog
),
467 .animation_frames
= anim_dog
,
468 .extent
= { FIXED_INT_I(8), FIXED_INT_I(5) },
469 .hitbox
= { { FIXED_INT_I(1), FIXED_INT_I(1) },
470 { FIXED_INT_I(6), FIXED_INT_I(4) } },
471 .spawn_inertia
= { FIXED_POINT_I(0, -200), FIXED_POINT_I(0, 0) },
472 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
473 .collision_player
= enemy_collision_player_jumpable
,
474 .game_tick
= enemy_tick_dog
476 .animation_ticks_per_frame
= 36,
477 .animation_length
= ARRAY_SIZE(anim_giraffe
),
478 .animation_frames
= anim_giraffe
,
479 .extent
= { FIXED_INT_I(7), FIXED_INT_I(10) },
480 .hitbox
= { { FIXED_INT_I(2), FIXED_INT_I(1) },
481 { FIXED_INT_I(4), FIXED_INT_I(9) } },
482 .spawn_inertia
= { FIXED_POINT_I(0, -150), FIXED_POINT_I(-1, -200) },
483 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
484 .collision_player
= enemy_collision_player_jumpable
,
485 .game_tick
= enemy_tick_giraffe
487 .animation_ticks_per_frame
= 24,
488 .animation_length
= ARRAY_SIZE(anim_bird
),
489 .animation_frames
= anim_bird
,
490 .extent
= { FIXED_INT_I(10), FIXED_INT_I(8) },
491 .hitbox
= { { FIXED_INT_I(2), FIXED_INT_I(3) },
492 { FIXED_INT_I(7), FIXED_INT_I(3) } },
493 .spawn_inertia
= { FIXED_POINT_I(0, -400), FIXED_POINT_I(0, -150) },
494 .collision_tiles
= enemy_collision_tiles_bounce_horiz
,
495 .collision_player
= enemy_collision_player_jumpable
,
496 .game_tick
= enemy_tick_swing_up_and_down