summaryrefslogtreecommitdiff
path: root/src/player.c
diff options
context:
space:
mode:
authorBoredGuy <osome3717@gmail.com>2026-03-16 17:47:57 +0300
committerBoredGuy <osome3717@gmail.com>2026-03-16 17:47:57 +0300
commitac02199694ffef81a00a8ea47420e88ef0a35f67 (patch)
treeab8be37dd6960954d7baa54bb1273980063c66ba /src/player.c
parent2c2be83a370318ca69824538ed3e61784295a772 (diff)
More work on systems
- Will be done soon (I think) - Added first entity
Diffstat (limited to 'src/player.c')
-rw-r--r--src/player.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/player.c b/src/player.c
new file mode 100644
index 0000000..5dd77c1
--- /dev/null
+++ b/src/player.c
@@ -0,0 +1,33 @@
+#include <raylib.h>
+#include "physics.h"
+#include "player.h"
+
+void add_player(float xpos, float ypos) {
+ struct entity player = {
+ .flags = (ENTITY_ACTIVE | ENTITY_VISIBLE),
+ .type = Player_Entity,
+
+ .position = (Vector2) {xpos, ypos},
+ .velocity = {100.0, 100.0},
+ .texture = LoadTexture("assets/Graphics/spritesheet-characters-double.png"),
+
+ .sprite_source_rect = (Rectangle) {
+ .x = 0,
+ .y = 0,
+ .width = 257,
+ .height = 257
+ },
+ .sprite_dest_rect = (Rectangle) {
+ .x = -50,
+ .y = -50,
+ .width = 100,
+ .height = 100
+ }
+ };
+
+ add_entity(&player);
+}
+
+void update_player(struct entity* entity, float dt) {
+ move_and_collide(entity, dt);
+}