mirror of https://git.sr.ht/~kikoodx/crystal-tower
29 lines
450 B
C
29 lines
450 B
C
#include "player.h"
|
|
#include "conf.h"
|
|
#include "vec.h"
|
|
#include <gint/display.h>
|
|
|
|
struct Player
|
|
player_new(struct Vec pos)
|
|
{
|
|
struct Player p;
|
|
p.pos = pos;
|
|
p.spd = VECFZ;
|
|
p.rem = VECFZ;
|
|
return p;
|
|
}
|
|
|
|
void
|
|
player_update(struct Player *restrict p)
|
|
{
|
|
p->pos.x++;
|
|
}
|
|
|
|
void
|
|
player_draw(struct Player *restrict p)
|
|
{
|
|
const int x2 = p->pos.x + PLAYER_WIDTH - 1;
|
|
const int y2 = p->pos.y + PLAYER_HEIGHT - 1;
|
|
drect(p->pos.x, p->pos.y, x2, y2, C_BLUE);
|
|
}
|