27 lines
400 B
C
27 lines
400 B
C
/*
|
|
** col.c - Collisions
|
|
**
|
|
** 2014 - Frank Villaro-Dixon <Frank@Villaro-Dixon.eu>
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "game.h"
|
|
#include "obs.h"
|
|
|
|
|
|
int
|
|
has_collision(struct s_game *g, struct s_obstacle o) {
|
|
int face = get_face_from_cursor(g);
|
|
|
|
if(face != o.face)
|
|
return 0;
|
|
|
|
if(o.distance <= CURSOR_DIST &&
|
|
o.distance + o.thick >= CURSOR_DIST) {
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|