1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
}
|