Textdateiankuckdingviech.
[hackover2013-badge-firmware.git] / badge / jumpnrun / enemies.c
1 #include "enemies.h"
2
3 #include "collision.h"
4 #include "game_state.h"
5 #include "tiles.h"
6 #include "jumpnrun.h"
7 #include "moveable.h"
8 #include "render.h"
9
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" }
13 };
14
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" }
22 };
23
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" }
30 };
31
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" }
37 };
38
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" }
48 };
49
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" }
55 };
56
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" }
62 };
63
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" }
71 };
72
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" }
76 /*
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" }
79 */
80 };
81
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;
86
87 ++enemy->base.anim_frame;
88 if(enemy->base.anim_frame >= enemy->type->animation_length) {
89 enemy->base.anim_frame = 0;
90 }
91 }
92 }
93
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;
100 }
101
102 static void jumpnrun_enemy_kill(jumpnrun_enemy *self) {
103 self->base.flags |= JUMPNRUN_MOVEABLE_DYING;
104 self->base.tick_minor = 0;
105 }
106
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;
112 }
113
114 void jumpnrun_enemy_reset (jumpnrun_enemy *self) {
115 jumpnrun_enemy_despawn(self);
116 self->base.flags &= ~JUMPNRUN_ENEMY_UNAVAILABLE;
117 }
118
119 static void enemy_bounce(jumpnrun_enemy *self) {
120 self->base.inertia.x = fixed_point_neg(self->base.inertia.x);
121 }
122
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); }
126
127 static inline void enemy_move_to(jumpnrun_enemy *self, vec2d new_pos) {
128 rectangle_move_to(&self->base.hitbox, new_pos);
129 }
130
131 static inline bool enemy_in_area(jumpnrun_enemy const *self, jumpnrun_game_state *state, int margin) {
132 return
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));
135 }
136
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);
139 }
140
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);
143 }
144
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(jumpnrun_moveable_dying(&self->base)) {
156 if(jumpnrun_moveable_finished_dying(&self->base)) {
157 jumpnrun_enemy_despawn(self);
158 } else {
159 if(fb) {
160 jumpnrun_render_splosion(fb, state, &self->base);
161 }
162 ++self->base.tick_minor;
163 }
164 } else {
165 if((self->base.flags & JUMPNRUN_ENEMY_MOVING) || enemy_on_screen(self, state)) {
166 self->base.flags |= JUMPNRUN_ENEMY_MOVING;
167
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; }
172 }
173
174 if(fb) {
175 jumpnrun_render_enemy(fb, state, self);
176 }
177 }
178 } else if(self->base.flags & JUMPNRUN_ENEMY_UNAVAILABLE) {
179 if(!enemy_in_spawn_area(self, state)) {
180 self->base.flags &= ~JUMPNRUN_ENEMY_UNAVAILABLE;
181 }
182 } else if(enemy_in_spawn_area(self, state)) {
183 // enemy unspawned, available and in spawn zone.
184 enemy_spawn(self);
185 }
186 }
187
188 void enemy_collision_tiles_bounce_horiz(jumpnrun_enemy *self,
189 vec2d *desired_position,
190 jumpnrun_level *lv,
191 jumpnrun_tile_range const *visible_tiles) {
192 vec2d inertia_mod = self->base.inertia;
193
194 bool killed = collisions_tiles_displace(desired_position,
195 &self->base,
196 lv,
197 visible_tiles,
198 &inertia_mod);
199 self->base.inertia.y = inertia_mod.y;
200
201 if(killed) {
202 jumpnrun_enemy_kill(self);
203 } else if(fixed_point_ne(inertia_mod.x, self->base.inertia.x)) {
204 enemy_bounce(self);
205 }
206 }
207
208 void enemy_collision_player_deadly(struct jumpnrun_enemy *self,
209 struct jumpnrun_game_state *state,
210 vec2d *player_inertia_mod) {
211 (void) player_inertia_mod;
212
213 if(rectangle_intersect(enemy_hitbox(self), &state->player.base.hitbox)) {
214 jumpnrun_player_kill(&state->player);
215 }
216 }
217
218 void enemy_collision_player_jumpable(jumpnrun_enemy *self,
219 jumpnrun_game_state *state,
220 vec2d *player_inertia_mod)
221 {
222 if(rectangle_intersect(enemy_hitbox(self), &state->player.base.hitbox)) {
223 if(fixed_point_lt(rectangle_top(&state->player.base.hitbox), rectangle_top(enemy_hitbox(self))) &&
224 fixed_point_gt(state->player.base.inertia.y, FIXED_INT(0)) &&
225 jumpnrun_player_alive(&state->player))
226 {
227 jumpnrun_enemy_kill(self);
228 player_inertia_mod->y = FIXED_POINT(0, -250);
229 state->player.base.jumpable_frames = 12;
230 } else {
231 jumpnrun_player_kill(&state->player);
232 }
233 }
234 }
235
236 void enemy_collision_tiles_pass_through(struct jumpnrun_enemy *self,
237 vec2d *desired_position,
238 struct jumpnrun_level *lv,
239 struct jumpnrun_tile_range const *visible_tiles) {
240 (void) self;
241 (void) desired_position;
242 (void) lv;
243 (void) visible_tiles;
244 }
245
246 void enemy_collision_shots_die(struct jumpnrun_enemy *self,
247 struct jumpnrun_game_state *state) {
248 for(uint8_t i = 0; i < JUMPNRUN_MAX_SHOTS; ++i) {
249 jumpnrun_shot *shot = &state->shots[i];
250
251 if(jumpnrun_shot_spawned(shot)) {
252 if(rectangle_intersect(enemy_hitbox(self), &shot->current_box)) {
253 jumpnrun_enemy_kill(self);
254 jumpnrun_shot_despawn(shot);
255 }
256 }
257 }
258 }
259
260 void enemy_collision_shots_bounce(struct jumpnrun_enemy *self,
261 struct jumpnrun_game_state *state) {
262 for(uint8_t i = 0; i < JUMPNRUN_MAX_SHOTS; ++i) {
263 jumpnrun_shot *shot = &state->shots[i];
264
265 if(jumpnrun_shot_spawned(shot)) {
266 if(rectangle_intersect(enemy_hitbox(self), &shot->current_box)) {
267 if(fixed_point_gt(shot->inertia.x, FIXED_INT(0))) {
268 rectangle_move_to_x(&shot->current_box, fixed_point_sub(rectangle_left(enemy_hitbox(self)), rectangle_width(&shot->current_box)));
269 } else {
270 rectangle_move_to_x(&shot->current_box, rectangle_right(enemy_hitbox(self)));
271 }
272
273 shot->inertia.x = fixed_point_neg(shot->inertia.x);
274 }
275 }
276 }
277 }
278
279 void enemy_collision_shots_dontcare(struct jumpnrun_enemy *self,
280 struct jumpnrun_game_state *state) {
281 (void) self;
282 (void) state;
283 }
284
285 static void enemy_tick_common(jumpnrun_enemy *self,
286 jumpnrun_game_state *state,
287 jumpnrun_level *lv,
288 jumpnrun_tile_range const *visible_tiles,
289 vec2d *player_inertia_mod) {
290 vec2d new_pos = enemy_pos_desired(self);
291 self->type->collision_tiles (self, &new_pos, lv, visible_tiles);
292 self->type->collision_player(self, state, player_inertia_mod);
293 enemy_move_to(self, new_pos);
294 }
295
296 void enemy_tick_straight_ahead(jumpnrun_enemy *self,
297 jumpnrun_game_state *state,
298 jumpnrun_level *lv,
299 jumpnrun_tile_range const *visible_tiles,
300 vec2d *player_inertia_mod) {
301 jumpnrun_passive_movement(&self->base.inertia);
302 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
303 enemy_animation_advance(self);
304 }
305
306 void enemy_tick_straight_follow(jumpnrun_enemy *self,
307 jumpnrun_game_state *state,
308 jumpnrun_level *lv,
309 jumpnrun_tile_range const *visible_tiles,
310 vec2d *player_inertia_mod) {
311 jumpnrun_passive_movement(&self->base.inertia);
312 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
313
314 if(fixed_point_lt(rectangle_right(&state->player.base.hitbox), rectangle_left(enemy_hitbox(self)))) {
315 self->base.inertia.x = self->type->spawn_inertia.x;
316 } else if(fixed_point_gt(rectangle_left(&state->player.base.hitbox), rectangle_right(enemy_hitbox(self)))) {
317 self->base.inertia.x = fixed_point_neg(self->type->spawn_inertia.x);
318 }
319
320 enemy_animation_advance(self);
321 }
322
323 void enemy_tick_swing_up_and_down(struct jumpnrun_enemy *self,
324 struct jumpnrun_game_state *state,
325 struct jumpnrun_level *lv,
326 struct jumpnrun_tile_range const *visible_tiles,
327 vec2d *player_inertia_mod) {
328 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
329
330 self->base.inertia.y =
331 fixed_point_add(fixed_point_add(self->base.inertia.y,
332 fixed_point_div(self->type->spawn_inertia.y, FIXED_INT(3))),
333 fixed_point_mul(FIXED_POINT(0, 5),
334 fixed_point_sub(self->spawn_pos.y,
335 enemy_pos_display(self).y)));
336
337 enemy_animation_advance(self);
338 }
339
340 void enemy_tick_stationary(struct jumpnrun_enemy *self,
341 struct jumpnrun_game_state *state,
342 struct jumpnrun_level *lv,
343 struct jumpnrun_tile_range const *visible_tiles,
344 vec2d *player_inertia_mod) {
345 self->type->collision_tiles(self, &self->base.hitbox.pos, lv, visible_tiles);
346 self->type->collision_player(self, state, player_inertia_mod);
347
348 enemy_animation_advance(self);
349 }
350
351 void enemy_tick_jumper(jumpnrun_enemy *self,
352 jumpnrun_game_state *state,
353 jumpnrun_level *lv,
354 jumpnrun_tile_range const *visible_tiles,
355 vec2d *player_inertia_mod) {
356 jumpnrun_passive_movement(&self->base.inertia);
357 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
358
359 if(jumpnrun_moveable_touching_ground(&self->base)) {
360 self->base.inertia.y = self->type->spawn_inertia.y;
361 }
362
363 enemy_animation_advance(self);
364 }
365
366 void enemy_tick_dog(jumpnrun_enemy *self,
367 jumpnrun_game_state *state,
368 jumpnrun_level *lv,
369 jumpnrun_tile_range const *visible_tiles,
370 vec2d *player_inertia_mod) {
371 jumpnrun_passive_movement(&self->base.inertia);
372 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
373
374 if(self->base.tick_minor % self->type->animation_ticks_per_frame == 0) {
375 switch(self->base.tick_minor / self->type->animation_ticks_per_frame) {
376 case 12:
377 self->base.tick_minor = 0;
378 case 0:
379 case 2:
380 case 4:
381 case 6:
382 self->base.anim_frame = 0;
383 if(self->base.flags & JUMPNRUN_MOVEABLE_MIRRORED) {
384 self->base.inertia.x = fixed_point_neg(self->type->spawn_inertia.x);
385 } else {
386 self->base.inertia.x = self->type->spawn_inertia.x;
387 }
388
389 break;
390
391 case 1:
392 case 3:
393 case 5:
394 case 7:
395 self->base.anim_frame = 1;
396 if(self->base.flags & JUMPNRUN_MOVEABLE_MIRRORED) {
397 self->base.inertia.x = fixed_point_neg(self->type->spawn_inertia.x);
398 } else {
399 self->base.inertia.x = self->type->spawn_inertia.x;
400 }
401 break;
402
403 case 8:
404 case 10:
405 self->base.anim_frame = 2;
406 self->base.inertia.x = FIXED_INT(0);
407 break;
408
409 case 9:
410 case 11:
411 self->base.anim_frame = 3;
412 self->base.inertia.x = FIXED_INT(0);
413 break;
414 }
415 }
416
417 ++self->base.tick_minor;
418 }
419
420 void enemy_tick_giraffe(jumpnrun_enemy *self,
421 jumpnrun_game_state *state,
422 jumpnrun_level *lv,
423 jumpnrun_tile_range const *visible_tiles,
424 vec2d *player_inertia_mod) {
425 bool was_on_ground = jumpnrun_moveable_touching_ground(&self->base);
426
427 jumpnrun_passive_movement(&self->base.inertia);
428 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
429
430 if(jumpnrun_moveable_touching_ground(&self->base)) {
431 if(was_on_ground) {
432 enemy_animation_advance(self);
433 if(self->base.anim_frame == 0) {
434 self->base.inertia = self->type->spawn_inertia;
435
436 if(fixed_point_gt(rectangle_mid_x(&state->player.base.hitbox), rectangle_mid_x(enemy_hitbox(self)))) {
437 self->base.inertia.x = fixed_point_neg(self->base.inertia.x);
438 }
439 }
440 } else {
441 self->base.tick_minor = 0;
442 self->base.anim_frame = 3;
443 self->base.inertia.x = FIXED_INT(0);
444 }
445 } else if(was_on_ground) {
446 self->base.tick_minor = 0;
447 self->base.anim_frame = 1;
448 } else if(self->base.anim_frame == 1) {
449 enemy_animation_advance(self);
450 }
451
452 ++self->base.tick_minor;
453 }
454
455 void enemy_tick_fly_straight(struct jumpnrun_enemy *self,
456 struct jumpnrun_game_state *state,
457 struct jumpnrun_level *lv,
458 struct jumpnrun_tile_range const *visible_tiles,
459 vec2d *player_inertia_mod) {
460 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
461 enemy_animation_advance(self);
462 }
463
464 void enemy_tick_fly_straight_and_dip(struct jumpnrun_enemy *self,
465 struct jumpnrun_game_state *state,
466 struct jumpnrun_level *lv,
467 struct jumpnrun_tile_range const *visible_tiles,
468 vec2d *player_inertia_mod) {
469 if(fixed_point_lt(fixed_point_abs(fixed_point_sub(enemy_pos_hitbox(self).x,
470 state->player.base.hitbox.pos.x)),
471 FIXED_INT(20))) {
472 self->base.flags |= JUMPNRUN_ENEMY_EVENT_TRIGGER1;
473 }
474
475 if(self->base.flags & JUMPNRUN_ENEMY_EVENT_TRIGGER1) {
476 self->base.inertia.y =
477 fixed_point_add(fixed_point_add(self->base.inertia.y,
478 fixed_point_div(self->type->spawn_inertia.y, FIXED_INT(3))),
479 fixed_point_mul(FIXED_POINT(0, 5),
480 fixed_point_sub(self->spawn_pos.y,
481 enemy_pos_hitbox(self).y)));
482 } else {
483 self->base.inertia.y = FIXED_INT(0);
484 }
485
486 enemy_tick_common(self, state, lv, visible_tiles, player_inertia_mod);
487 enemy_animation_advance(self);
488 }
489
490 jumpnrun_enemy_type const jumpnrun_enemy_type_data[JUMPNRUN_ENEMY_TYPE_COUNT] = {
491 {
492 .animation_ticks_per_frame = 18,
493 .animation_length = ARRAY_SIZE(anim_cat),
494 .animation_frames = anim_cat,
495 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(2) },
496 { FIXED_INT_I(6), FIXED_INT_I(3) } },
497 .spawn_inertia = { FIXED_POINT_I(0, -200), FIXED_INT_I(0) },
498 .collision_tiles = enemy_collision_tiles_bounce_horiz,
499 .collision_player = enemy_collision_player_jumpable,
500 .collision_shots = enemy_collision_shots_die,
501 .move_tick = enemy_tick_straight_ahead
502 }, {
503 .animation_ticks_per_frame = 12,
504 .animation_length = ARRAY_SIZE(anim_mushroom),
505 .animation_frames = anim_mushroom,
506 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(1) },
507 { FIXED_INT_I(5), FIXED_INT_I(6) } },
508 .spawn_inertia = { FIXED_POINT_I(0, -80), FIXED_INT_I(0) },
509 .collision_tiles = enemy_collision_tiles_bounce_horiz,
510 .collision_player = enemy_collision_player_jumpable,
511 .collision_shots = enemy_collision_shots_die,
512 .move_tick = enemy_tick_straight_follow
513 }, {
514 .animation_ticks_per_frame = 9,
515 .animation_length = ARRAY_SIZE(anim_bunny),
516 .animation_frames = anim_bunny,
517 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(2) },
518 { FIXED_INT_I(5), FIXED_INT_I(3) } },
519 .spawn_inertia = { FIXED_POINT_I(0, -80), FIXED_POINT_I(0, -800) },
520 .collision_tiles = enemy_collision_tiles_bounce_horiz,
521 .collision_player = enemy_collision_player_jumpable,
522 .collision_shots = enemy_collision_shots_die,
523 .move_tick = enemy_tick_jumper
524 }, {
525 .animation_ticks_per_frame = 6,
526 .animation_length = ARRAY_SIZE(anim_snake),
527 .animation_frames = anim_snake,
528 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(4) },
529 { FIXED_INT_I(8), FIXED_INT_I(2) } },
530 .spawn_inertia = { FIXED_POINT_I(0, -150), FIXED_INT_I(0) },
531 .collision_tiles = enemy_collision_tiles_bounce_horiz,
532 .collision_player = enemy_collision_player_jumpable,
533 .collision_shots = enemy_collision_shots_die,
534 .move_tick = enemy_tick_straight_ahead
535 }, {
536 .animation_ticks_per_frame = 6,
537 .animation_length = ARRAY_SIZE(anim_spiral),
538 .animation_frames = anim_spiral,
539 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(1) },
540 { FIXED_INT_I(8), FIXED_INT_I(8) } },
541 .spawn_inertia = { FIXED_INT_I(0), FIXED_POINT_I(0, -200) },
542 .collision_tiles = enemy_collision_tiles_pass_through,
543 .collision_player = enemy_collision_player_deadly,
544 .collision_shots = enemy_collision_shots_dontcare,
545 .move_tick = enemy_tick_swing_up_and_down
546 }, {
547 .animation_ticks_per_frame = 5,
548 .animation_length = ARRAY_SIZE(anim_rotor),
549 .animation_frames = anim_rotor,
550 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(1) },
551 { FIXED_INT_I(7), FIXED_INT_I(7) } },
552 .spawn_inertia = { FIXED_INT_I(0), FIXED_POINT_I(0, 0) },
553 .collision_tiles = enemy_collision_tiles_pass_through,
554 .collision_player = enemy_collision_player_deadly,
555 .collision_shots = enemy_collision_shots_dontcare,
556 .move_tick = enemy_tick_stationary
557 }, {
558 .animation_ticks_per_frame = 18,
559 .animation_length = ARRAY_SIZE(anim_dog),
560 .animation_frames = anim_dog,
561 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(1) },
562 { FIXED_INT_I(6), FIXED_INT_I(4) } },
563 .spawn_inertia = { FIXED_POINT_I(0, -200), FIXED_POINT_I(0, 0) },
564 .collision_tiles = enemy_collision_tiles_bounce_horiz,
565 .collision_player = enemy_collision_player_jumpable,
566 .collision_shots = enemy_collision_shots_die,
567 .move_tick = enemy_tick_dog
568 }, {
569 .animation_ticks_per_frame = 36,
570 .animation_length = ARRAY_SIZE(anim_giraffe),
571 .animation_frames = anim_giraffe,
572 .hitbox = { { FIXED_INT_I(2), FIXED_INT_I(1) },
573 { FIXED_INT_I(4), FIXED_INT_I(9) } },
574 .spawn_inertia = { FIXED_POINT_I(0, -150), FIXED_POINT_I(-1, -200) },
575 .collision_tiles = enemy_collision_tiles_bounce_horiz,
576 .collision_player = enemy_collision_player_jumpable,
577 .collision_shots = enemy_collision_shots_bounce,
578 .move_tick = enemy_tick_giraffe
579 }, {
580 .animation_ticks_per_frame = 24,
581 .animation_length = ARRAY_SIZE(anim_bird),
582 .animation_frames = anim_bird,
583 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(3) },
584 { FIXED_INT_I(7), FIXED_INT_I(3) } },
585 .spawn_inertia = { FIXED_POINT_I(0, -400), FIXED_POINT_I(0, -150) },
586 .collision_tiles = enemy_collision_tiles_bounce_horiz,
587 .collision_player = enemy_collision_player_jumpable,
588 .collision_shots = enemy_collision_shots_die,
589 .move_tick = enemy_tick_swing_up_and_down
590 }, {
591 .animation_ticks_per_frame = 24,
592 .animation_length = ARRAY_SIZE(anim_bird),
593 .animation_frames = anim_bird,
594 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(3) },
595 { FIXED_INT_I(7), FIXED_INT_I(3) } },
596 .spawn_inertia = { FIXED_POINT_I(0, -400), FIXED_INT_I(0) },
597 .collision_tiles = enemy_collision_tiles_bounce_horiz,
598 .collision_player = enemy_collision_player_jumpable,
599 .collision_shots = enemy_collision_shots_die,
600 .move_tick = enemy_tick_fly_straight
601 }, {
602 .animation_ticks_per_frame = 24,
603 .animation_length = ARRAY_SIZE(anim_bird),
604 .animation_frames = anim_bird,
605 .hitbox = { { FIXED_INT_I(1), FIXED_INT_I(3) },
606 { FIXED_INT_I(7), FIXED_INT_I(3) } },
607 .spawn_inertia = { FIXED_POINT_I(0, -400), FIXED_POINT_I(0, 200) },
608 .collision_tiles = enemy_collision_tiles_bounce_horiz,
609 .collision_player = enemy_collision_player_jumpable,
610 .collision_shots = enemy_collision_shots_die,
611 .move_tick = enemy_tick_fly_straight_and_dip
612 }
613 };
This page took 0.082059 seconds and 5 git commands to generate.