diff --git a/Readme.md b/Readme.md index d0a8a60..500e547 100644 --- a/Readme.md +++ b/Readme.md @@ -14,14 +14,17 @@ Cub3D is a simple raycasting game using the mlx library - Animated Sprites ### Extra - Levels? +- Barrels? +- Collectables - Enemies? - Moving Enemies? - Weapon Sprite that fires? -- Barrels? +- Zoom with right mouse button? +- Help screen? - Skybox? - Sounds? - Music? -- A Menu? +- A Start Menu? - Jumping? - Vertical Aiming? @@ -46,6 +49,7 @@ Cub3D is a simple raycasting game using the mlx library --- ## Bugs - Player gets stuck in walls +- Player walks twice as fast when holding W and A or W and D --- ## Usage diff --git a/config.cub b/config.cub index de42012..c62fbda 100644 --- a/config.cub +++ b/config.cub @@ -6,27 +6,27 @@ EA ./assets/colorstone.png SO ./assets/redbrick.png WE ./assets/wood.png -111111111111111111111111 -100000000000000000000001 -100000000000000000000001 -100000000000000000000001 -100000111110000101010001 -100000100010000000000001 -100000100010000100010001 -100000100010000000000001 -100000110110000101010001 -100000000000000000000001 -100000000000000000000001 -100000000000100000000001 -100000000000000000000001 -100000000000000000000001 -100000000000000000000001 -100000000000000000000001 -111111111000000000000001 -110100001000000000000001 -110000101000000000000001 -110100001000000000000001 -11011111100000000000N001 -110000000000000000000001 -111111111000000000000001 -111111111111111111111111 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1 B1 1 1 1 1 1 +1 K D K K 1 C D D X 1 +1 1 1 1 1 1 1 +1 11111111111 11111111111 111111111111111111111 1 1111111111 1111111111 +1 1B C B1 1 1 1 1 1 D K K 1 1 +1 1 K K 1 1 K K D 1 C 1 K K D 1 1 K K K K K K 1 +1 1 1 1 1 1 1 1 1111111111 K K K K 1 +1 11111 11111 11111111111 D K K K 11111111111 1 1 K K K K 1 +1 1 1 1 K K 1 1 D K K 1 K K 1 +1 1 K K D 1 1 K K D 1 1 1 +1 1 1 11111111111 1 1111111111 1 +1 11111111111 1 11111111111 1 1 1 +1 1 1 D K K 1 1 D K K 1 1 +1 1 K K D 1 1 K K D 1 1 1 +1 1 1 11111111111 1 1111111111 1 +111111111 11111111111 1 11111111111 1 1 1 +1B1 1 1 1 D K K 1 1 D C 1 1 +1 K K K 1 1 K K 1 1 1 K K D 1 1 1 +1 1 C 1 1 K K K D 11111111111 K K K 1 1111111111 1 +1 1 1 N 1 K K 1 1 1 K K 1 1 1 +1 1111111 1 C 1 D K K 1 C 1 1 +1 1 1BBB1 1 1 B1 1 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/src/keys.c b/src/keys.c index dce23fb..3ff2cab 100644 --- a/src/keys.c +++ b/src/keys.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:50:23 by houtworm #+# #+# */ -/* Updated: 2023/10/29 15:55:18 by houtworm ######## odam.nl */ +/* Updated: 2023/10/29 17:35:38 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -103,7 +103,7 @@ void keyhook(mlx_key_data_t kd, void *param) mlx_close_window(vl->mlx); return ; } - if (kd.key == MLX_KEY_H && kd.action == MLX_PRESS) + if ((kd.key == MLX_KEY_H || kd.key == MLX_KEY_F1) && kd.action == MLX_PRESS) ft_putendl("H is pressed"); if (kd.modifier == MLX_SHIFT) vl->run = 2; @@ -124,7 +124,6 @@ void scrollhook(double xdelta, double ydelta, void *param) ft_putendl("scroll down"); } -#include void cursorhook(double xpos, double ypos, void *param) { t_varlist *vl; diff --git a/src/map.c b/src/map.c index 22ab0d2..c1ee5e9 100644 --- a/src/map.c +++ b/src/map.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 17:33:50 by houtworm #+# #+# */ -/* Updated: 2023/10/29 15:23:13 by houtworm ######## odam.nl */ +/* Updated: 2023/10/29 17:53:01 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -83,10 +83,27 @@ char **ft_getmap(t_varlist *vl, int fd) return (NULL); if (ft_strchr(" 0", line[x])) map[y][x] = '0'; - else if (ft_strchr("1", line[x])) + else if (line[x] == '1') map[y][x] = '1'; else if (ft_strchr("NESW", line[x])) map[y][x] = ft_setplayerpos(vl, line[x], y, x); + else if (line[x] == 'D') + map[y][x] = 'D'; + else if (line[x] == 'C') + map[y][x] = 'C'; + else if (line[x] == 'B') + map[y][x] = 'B'; + else if (line[x] == 'X') + map[y][x] = 'X'; + else if (line[x] == 'K') + map[y][x] = 'K'; + else + { + ft_putstr("Invalid character on the map\n Valid options are\n"); + ft_putstr("NESW Player\n' ' or 0 empty space\n1 wall\n"); + ft_putstr("D Door\nC Collectible\nB Barrel\nX Level end\n"); + ft_errorexit("K Enemy\n", "", 1); + } x++; } free(line);