From ac02199694ffef81a00a8ea47420e88ef0a35f67 Mon Sep 17 00:00:00 2001 From: BoredGuy Date: Mon, 16 Mar 2026 17:47:57 +0300 Subject: More work on systems - Will be done soon (I think) - Added first entity --- src/player.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/player.c (limited to 'src/player.c') 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 +#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); +} -- cgit v1.2.3