movement: generalize; use vectors (#16)

Generalized movement, so that all entities move the same.

Reviewed-on: #16
Reviewed-by: raf <raf@notashelf.dev>
Co-authored-by: Squirrel Modeller <squirrelmodeller@protonmail.com>
Co-committed-by: Squirrel Modeller <squirrelmodeller@protonmail.com>
This commit is contained in:
Squirrel Modeller 2026-04-09 14:11:46 +00:00 committed by raf
commit 4dfe52ae72
9 changed files with 124 additions and 89 deletions

View file

@ -4,6 +4,10 @@
#include "settings.h"
#include <raylib.h>
typedef struct {
int x, y;
} Vec2;
// Tile types
typedef enum { TILE_WALL, TILE_FLOOR, TILE_STAIRS } TileType;
@ -57,7 +61,7 @@ typedef struct {
// Player
typedef struct {
int x, y;
Vec2 position;
int hp, max_hp;
int attack;
int defense;
@ -83,7 +87,7 @@ typedef enum { ENEMY_GOBLIN, ENEMY_SKELETON, ENEMY_ORC } EnemyType;
// Enemy
typedef struct {
int x, y;
Vec2 position;
int hp;
int max_hp;
int attack;