Start position support.

This commit is contained in:
KikooDX 2021-01-13 14:24:00 +01:00
parent 6595a27503
commit c9548c1a67
3 changed files with 6 additions and 5 deletions

View File

@ -4,10 +4,12 @@
#include <gint/defs/types.h>
#include "tiles.h"
#include "vec.h"
typedef struct Level {
uint width; /* in tiles */
uint height; /* in tiles */
uint8_t width; /* in tiles */
uint8_t height; /* in tiles */
Vec start_pos; /* player starting position */
uint16_t bg_color; /* background color */
const Tile **layers; /* points toward the level content */
uint8_t layers_count;

2
levels

@ -1 +1 @@
Subproject commit 144f9142f3b7a9bf015fd254516bfa3342d370fc
Subproject commit a310ffb5a6a7c67df3a46b566a3f865cfa7d9ffd

View File

@ -26,8 +26,7 @@
#define PLAYER_COLLIDE_SOLID(pos) (player_collide_or(player, pos, level) & F_SOLID)
void player_init(Player *player, const Level *level) {
player->pos.x = TILE_SIZE;
player->pos.y = TILE_SIZE;
vec_cpy(&player->pos, level->start_pos);
player->spd.x = 0;
player->spd.y = 0;
player->hbox.x = TILE_SIZE - 1;