示例#1
0
文件: actors.c 项目: witheld9/Torch
int walkActor(character *actor, int dx, int dy) {
	int currentDx = -1, currentDy = -1;
	
	if (!isPositionWalkable(dx, dy)) {
		printf("Invalid pathing destination: %i, %i\n", dx, dy);
		
		return 0;
	}
	
	if (TCOD_path_size(actor->path)) {
		TCOD_path_get_destination(actor->path, &currentDx, &currentDy);
		
		if (dx == currentDx && dy == currentDy) {
			return 1;
		}
	}
	
	if (!TCOD_path_compute(actor->path, actor->x, actor->y, dx, dy)) {
		//printf("Invalid path!\n");

		return 0;
	}

	return 1;
}
示例#2
0
文件: actors.c 项目: witheld9/Torch
void walkActorPath(character *actor) {
	int nx, ny;
	
	if (TCOD_path_size(actor->path)) {
		TCOD_path_walk(actor->path, &nx, &ny, true);
		
		moveActor(actor, nx - actor->x, ny - actor->y);
	}
}
示例#3
0
文件: path.cpp 项目: smarmy/HellRogue
int TCODPath::size() const {
	return TCOD_path_size(data);
}