30 lines
1.3 KiB
C
30 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* collision.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/04/22 14:40:59 by qmennen #+# #+# */
|
|
/* Updated: 2025/05/06 15:20:18 by qmennen ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "collision.h"
|
|
|
|
int collision_horizontal(t_map *map, t_player *player, double xa)
|
|
{
|
|
t_tile tile;
|
|
|
|
tile = get_tile(map, (int)((player->pos.x + xa)), (int)((player->pos.y)));
|
|
return (tile != TILE_WALL && tile != TILE_VOID);
|
|
}
|
|
|
|
int collision_vertical(t_map *map, t_player *player, double ya)
|
|
{
|
|
t_tile tile;
|
|
|
|
tile = get_tile(map, (int)((player->pos.x)), (int)((player->pos.y + ya)));
|
|
return (tile != TILE_WALL && tile != TILE_VOID);
|
|
}
|