forked from NotAShelf/rogged
render: add player sprite. welcome to dude man
This commit is contained in:
parent
4178c540a6
commit
84dd0b5b7a
6 changed files with 8 additions and 5 deletions
BIN
assets/entities/player.png
Normal file
BIN
assets/entities/player.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 214 B |
BIN
assets/entities/player.png.kra
Normal file
BIN
assets/entities/player.png.kra
Normal file
Binary file not shown.
BIN
assets/entities/player_white.png
Normal file
BIN
assets/entities/player_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 198 B |
|
|
@ -501,6 +501,8 @@ static void game_loop(void) {
|
|||
load_audio_assets(&gs);
|
||||
// font
|
||||
Font fontTTF = LoadFontEx("./assets/fonts/Royal_Decree_Bold.ttf", 14, 0, 250);
|
||||
// entities
|
||||
Texture2D player_tile = LoadTexture("./assets/entities/player_white.png");
|
||||
// Initialize first floor
|
||||
rng_seed(12345);
|
||||
init_floor(&gs, 1);
|
||||
|
|
@ -548,7 +550,7 @@ static void game_loop(void) {
|
|||
render_map(&gs.map);
|
||||
render_items(gs.items, gs.item_count);
|
||||
render_enemies(gs.enemies, gs.enemy_count);
|
||||
render_player(&gs.player);
|
||||
render_player(&gs.player, &player_tile);
|
||||
EndMode2D();
|
||||
|
||||
// Floating texts follow world shake
|
||||
|
|
|
|||
|
|
@ -29,9 +29,10 @@ void render_map(const Map *map) {
|
|||
}
|
||||
}
|
||||
|
||||
void render_player(const Player *p) {
|
||||
Rectangle rect = {(float)(p->x * TILE_SIZE), (float)(p->y * TILE_SIZE), (float)TILE_SIZE, (float)TILE_SIZE};
|
||||
DrawRectangleRec(rect, BLUE);
|
||||
void render_player(const Player *p, Texture2D *ptile) {
|
||||
// Rectangle rect = {(float)(p->x * TILE_SIZE), (float)(p->y * TILE_SIZE), (float)TILE_SIZE, (float)TILE_SIZE};
|
||||
// DrawRectangleRec(rect, BLUE);
|
||||
DrawTexture(*ptile, (float)(p->x * TILE_SIZE), (float)(p->y * TILE_SIZE), (Color){255, 255, 255, 255});
|
||||
}
|
||||
|
||||
void render_enemies(const Enemy *enemies, int count) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
void render_map(const Map *map);
|
||||
|
||||
// Render the player
|
||||
void render_player(const Player *p);
|
||||
void render_player(const Player *p, Texture2D *ptile);
|
||||
|
||||
// Render all enemies
|
||||
void render_enemies(const Enemy *enemies, int count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue