blob: 71a8c304b3fadd0a5eaf9f3230a9f0f6854b8b1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "player.h"
static int2 pos = I2(0, 0);
static int2 dir = I2(1, 0);
void
player_update(void)
{
if (input_pressed("action")) {
dir = I2(dir.y, -dir.x);
int2_log(log, dir);
}
pos = int2_add(pos, dir);
}
void
player_draw(void)
{
TZR_DrawSetColor(0, 0, 0);
TZR_DrawRectangle(UNPACK(pos), 3, 4, true, true);
}
|