animation is now decoupled from sprite

This commit is contained in:
huaqo-games
2025-02-08 17:47:12 +01:00
parent 0c73d94187
commit bcb1577694
7 changed files with 121 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
#ifndef PHYSICS_H
#define PHYSICS_H
#include <raylib.h>
#include <raymath.h>
typedef struct {
Vector2 position;
Vector2 direction;
float speed;
} Physics;
Vector2 GetVelocity(Vector2 *direction, float *speed){
return Vector2Scale(*direction, *speed * GetFrameTime());
}
void Move(Vector2 *position, Vector2 *direction, float *speed) {
*position = Vector2Add(*position, GetVelocity(direction, speed));
}
#endif // PHYSICS_H