feat(player): redid all the movement code more details in desc

- had to tamper at init with the map pointer to allow player to move
- tweaked movement speed
- allowed for multiple keys to be pressed at the same time
- added collisions
- had to modify minimap code because it segfaulted due to old code
This commit is contained in:
Theo Champion 2025-07-29 14:58:30 +02:00
parent ac94e9e937
commit faf5127829
11 changed files with 143 additions and 40 deletions

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/29 11:42:44 by tchampio #+# #+# */
/* Updated: 2025/07/29 12:04:52 by tchampio ### ########.fr */
/* Updated: 2025/07/29 14:44:44 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -58,6 +58,7 @@ void init_player(t_player *player, t_mapdata *map)
dir = map->map[map->starty][map->startx];
player->x = map->startx + 0.5;
player->y = map->starty + 0.5;
map->map[map->starty][map->startx] = '0';
player->health = 100;
player->points = 500;
if (dir == 'N' || dir == 'S')