summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-12-31 01:30:29 +0100
committerkdx <kikoodx@paranoici.org>2023-12-31 01:30:29 +0100
commit0b826cea778873fb0bb5407e1a2539dcc4d8a6be (patch)
treecf59dcdca6b746b02ecaf67c17400b7f0ebc0a2f
parentda025eaa5350bfb71053409ac1cbf3f1ae2ea572 (diff)
download007-0b826cea778873fb0bb5407e1a2539dcc4d8a6be.tar.gz
gamelay
-rw-r--r--src/main.c2
-rw-r--r--src/player.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index d433ff1..e2d08b0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,7 +46,7 @@ _main_loop([[maybe_unused]] void *udata)
player_update();
assert(TZR_DrawBegin() == 0);
- if (rand() % 1 == 0) {
+ if (rand() % 10 == 0) {
int r; do r = rand(); while ((r & 7) == 0);
TZR_DrawSetColor(r & 1, (r & 2) != 0, (r & 4) != 0);
TZR_DrawClear();
diff --git a/src/player.c b/src/player.c
index a2d594d..71a8c30 100644
--- a/src/player.c
+++ b/src/player.c
@@ -1,5 +1,6 @@
#include "player.h"
+static int2 pos = I2(0, 0);
static int2 dir = I2(1, 0);
void
@@ -9,9 +10,13 @@ player_update(void)
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);
}