diff options
Diffstat (limited to 'src/player.c')
| -rw-r--r-- | src/player.c | 33 |
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); +} |
