Vorarbeit f. Schüsse/Würfe. Animation steht, TODO: Gegner darauf reagieren
[hackover2013-badge-firmware.git] / badge / jumpnrun / enemies.c
1 #include "enemies.h"
2
3 #include "collision.h"
4 #include "tiles.h"
5 #include "jumpnrun.h"
6
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" }
10 };
11
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" }
19 };
20
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" }
27 };
28
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" }
34 };
35
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" }
45 };
46
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" }
52 };
53
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" }
59 };
60
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" }
68 };
69
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" }
73 };
74
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;
79
80 ++enemy->base.anim_frame;
81 if(enemy->base.anim_frame >= enemy->type->animation_length) {
82 enemy->base.anim_frame = 0;
83 }
84 }
85 }
86
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;
94
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;
100 } else {
101 self->type->game_tick(self, state, lv, visible_tiles, player_inertia_mod);
102
103 if(fb) {
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))),
107 enemy_sprite(self),
108 enemy_render_flags(self));
109 }
110 }
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;
115 }
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;
128 }
129 }
130
131 void enemy_collision_tiles_bounce_horiz(jumpnrun_enemy *self,
132 vec2d *desired_position,
133 jumpnrun_level *lv,
134 jumpnrun_tile_range const *visible_tiles) {
135 vec2d inertia_mod = self->base.inertia;
136
137 collisions_tiles_displace(desired_position,
138 &self->base,
139 lv,
140 visible_tiles,
141 &inertia_mod);
142
143 if(fixed_point_ne(inertia_mod.x, self->base.inertia.x)) {
144 self->base.inertia.x = fixed_point_neg(self->base.inertia.x);
145 }
146 }
147
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;
152
153 rectangle rect_self = enemy_hitbox(self);
154
155 if(rectangle_intersect(&rect_self, &state->player.current_box)) {
156 state->status = JUMPNRUN_DEAD;
157 }
158 }
159
160 void enemy_collision_player_jumpable(jumpnrun_enemy *self,
161 jumpnrun_game_state *state,
162 vec2d *player_inertia_mod)
163 {
164 rectangle rect_self = enemy_hitbox(self);
165
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;
171 } else {
172 state->status = JUMPNRUN_DEAD;
173 }
174 }
175 }
176
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) {
181 (void) self;
182 (void) desired_position;
183 (void) lv;
184 (void) visible_tiles;
185 return;
186 }
187
188 void enemy_tick_straight_ahead(jumpnrun_enemy *self,
189 jumpnrun_game_state *state,
190 jumpnrun_level *lv,
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));
194
195 if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
196 screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
197 return;
198 }
199
200 jumpnrun_passive_movement(&self->base.inertia);
201
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);
206
207 enemy_animation_advance(self);
208 }
209
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));
216
217 if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
218 screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
219 return;
220 }
221
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);
226
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)));
233
234 enemy_animation_advance(self);
235 }
236
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));
243
244 if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
245 screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
246 return;
247 }
248
249 self->type->collision_tiles(self, &self->base.current_box.pos, lv, visible_tiles);
250 self->type->collision_player(self, state, player_inertia_mod);
251
252 enemy_animation_advance(self);
253 }
254
255 void enemy_tick_jumper(jumpnrun_enemy *self,
256 jumpnrun_game_state *state,
257 jumpnrun_level *lv,
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));
261
262 if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
263 screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
264 return;
265 }
266
267 jumpnrun_passive_movement(&self->base.inertia);
268
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);
273
274 if(self->base.touching_ground) {
275 self->base.inertia.y = self->type->spawn_inertia.y;
276 }
277
278 enemy_animation_advance(self);
279 }
280
281 void enemy_tick_dog(jumpnrun_enemy *self,
282 jumpnrun_game_state *state,
283 jumpnrun_level *lv,
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));
287
288 if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
289 screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
290 return;
291 }
292
293 jumpnrun_passive_movement(&self->base.inertia);
294
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);
299
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) {
302 case 12:
303 self->base.tick_minor = 0;
304 case 0:
305 case 2:
306 case 4:
307 case 6:
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);
311 } else {
312 self->base.inertia.x = self->type->spawn_inertia.x;
313 }
314
315 break;
316
317 case 1:
318 case 3:
319 case 5:
320 case 7:
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);
324 } else {
325 self->base.inertia.x = self->type->spawn_inertia.x;
326 }
327 break;
328
329 case 8:
330 case 10:
331 self->base.anim_frame = 2;
332 self->base.inertia.x = FIXED_INT(0);
333 break;
334
335 case 9:
336 case 11:
337 self->base.anim_frame = 3;
338 self->base.inertia.x = FIXED_INT(0);
339 break;
340 }
341 }
342
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; }
346 }
347
348 void enemy_tick_giraffe(jumpnrun_enemy *self,
349 jumpnrun_game_state *state,
350 jumpnrun_level *lv,
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));
354
355 if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
356 screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
357 return;
358 }
359
360 bool was_on_ground = self->base.touching_ground;
361
362 jumpnrun_passive_movement(&self->base.inertia);
363
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);
368
369 if(self->base.touching_ground) {
370 if(was_on_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;
376 } else {
377 self->base.inertia = self->type->spawn_inertia;
378 }
379 }
380 } else {
381 self->base.tick_minor = 0;
382 self->base.anim_frame = 3;
383 self->base.inertia.x = FIXED_INT(0);
384 }
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);
390 }
391
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; }
395 }
396
397 jumpnrun_enemy_type const jumpnrun_enemy_type_data[JUMPNRUN_ENEMY_TYPE_COUNT] = {
398 {
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
409 }, {
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
420 }, {
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
431 }, {
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
442 }, {
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
453 }, {
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
464 }, {
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
475 }, {
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
486 }, {
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
497 }
498 };
This page took 0.080835 seconds and 5 git commands to generate.