aboutsummaryrefslogtreecommitdiff
path: root/include/metasprite.h
blob: f4a15e7244e02e89920303d30bd747155c3611bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include <gb/gb.h>

#include "defines.h"

typedef struct Metasprite {
  ScreenCoordinate x;
  ScreenCoordinate y;
  UINT8 width;
  UINT8 height;
  INT8 velocity_x;
  INT8 velocity_y;
  UINT8 sprite_ids[4]; // A metasprite is four sprites.
  UINT8 tile_ids[4];   // A metasprite is four sprites.
} Metasprite;

inline void metasprite_init(Metasprite *metasprite);
inline void metasprite_move_to(Metasprite *metasprite, ScreenCoordinate new_x,
                               ScreenCoordinate new_y);
inline void metasprite_move_offset(Metasprite *metasprite,
                                   ScreenCoordinate offset_x,
                                   ScreenCoordinate offset_y);
inline void metasprite_apply_gravity(Metasprite *metasprite);
inline void metasprite_update_position_using_velocity(Metasprite *metasprite);
inline void metasprite_jump(Metasprite *metasprite);
inline void metasprite_update_tiles(Metasprite *metasprite);
inline void metasprite_hide(Metasprite *metasprite);