forked from NotAShelf/rogged
movement: generalize; use vectors (#16)
Generalized movement, so that all entities move the same. Reviewed-on: NotAShelf/rogged#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:
parent
1d738c35d4
commit
4dfe52ae72
9 changed files with 124 additions and 89 deletions
17
src/movement.h
Normal file
17
src/movement.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef MOVEMENT_H
|
||||
#define MOVEMENT_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef enum {
|
||||
MOVE_RESULT_MOVED,
|
||||
MOVE_RESULT_BLOCKED_WALL,
|
||||
MOVE_RESULT_BLOCKED_PLAYER,
|
||||
MOVE_RESULT_BLOCKED_ENEMY
|
||||
} MoveResult;
|
||||
|
||||
// Attempts to move entity in a given direction. Returns outcome of action.
|
||||
MoveResult try_move_entity(Vec2 *p, Vec2 direction, Map *map, Player *player, Enemy *enemies, int enemy_count,
|
||||
bool moving_is_player);
|
||||
|
||||
#endif // MOVEMENT_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue