-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity.c
33 lines (29 loc) · 806 Bytes
/
entity.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Created by Saturnation on 2/11/2018.
//
#include <malloc.h>
#include <stdio.h>
#include "entity.h"
void move(struct entity *e, int dx, int dy) {
e->x += dx;
e->y += dy;
}
struct entity *create_entity(int x,
int y,
char c,
TCOD_color_t color,
char *name,
bool blocks,
struct fighter *fighter,
void (*ai_action)(struct entity *, struct entity *, TCOD_Map *, struct game_map *, struct entity_list *)) {
struct entity *e = malloc(sizeof(struct entity));
e->x = x;
e->y = y;
e->c = c;
e->color = color;
e->name = name;
e->blocks = blocks;
e->fighter = fighter;
e->ai_action = ai_action;
return e;
}