made a nice map

This commit is contained in:
djonker 2023-10-29 18:24:24 +01:00
parent 6404a697a4
commit 70e63f0c8f
4 changed files with 51 additions and 31 deletions

View File

@ -14,14 +14,17 @@ Cub3D is a simple raycasting game using the mlx library
- Animated Sprites - Animated Sprites
### Extra ### Extra
- Levels? - Levels?
- Barrels?
- Collectables
- Enemies? - Enemies?
- Moving Enemies? - Moving Enemies?
- Weapon Sprite that fires? - Weapon Sprite that fires?
- Barrels? - Zoom with right mouse button?
- Help screen?
- Skybox? - Skybox?
- Sounds? - Sounds?
- Music? - Music?
- A Menu? - A Start Menu?
- Jumping? - Jumping?
- Vertical Aiming? - Vertical Aiming?
@ -46,6 +49,7 @@ Cub3D is a simple raycasting game using the mlx library
--- ---
## Bugs ## Bugs
- Player gets stuck in walls - Player gets stuck in walls
- Player walks twice as fast when holding W and A or W and D
--- ---
## Usage ## Usage

View File

@ -6,27 +6,27 @@ EA ./assets/colorstone.png
SO ./assets/redbrick.png SO ./assets/redbrick.png
WE ./assets/wood.png WE ./assets/wood.png
111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
100000000000000000000001 1 B1 1 1 1 1 1
100000000000000000000001 1 K D K K 1 C D D X 1
100000000000000000000001 1 1 1 1 1 1 1
100000111110000101010001 1 11111111111 11111111111 111111111111111111111 1 1111111111 1111111111
100000100010000000000001 1 1B C B1 1 1 1 1 1 D K K 1 1
100000100010000100010001 1 1 K K 1 1 K K D 1 C 1 K K D 1 1 K K K K K K 1
100000100010000000000001 1 1 1 1 1 1 1 1 1111111111 K K K K 1
100000110110000101010001 1 11111 11111 11111111111 D K K K 11111111111 1 1 K K K K 1
100000000000000000000001 1 1 1 1 K K 1 1 D K K 1 K K 1
100000000000000000000001 1 1 K K D 1 1 K K D 1 1 1
100000000000100000000001 1 1 1 11111111111 1 1111111111 1
100000000000000000000001 1 11111111111 1 11111111111 1 1 1
100000000000000000000001 1 1 1 D K K 1 1 D K K 1 1
100000000000000000000001 1 1 K K D 1 1 K K D 1 1 1
100000000000000000000001 1 1 1 11111111111 1 1111111111 1
111111111000000000000001 111111111 11111111111 1 11111111111 1 1 1
110100001000000000000001 1B1 1 1 1 D K K 1 1 D C 1 1
110000101000000000000001 1 K K K 1 1 K K 1 1 1 K K D 1 1 1
110100001000000000000001 1 1 C 1 1 K K K D 11111111111 K K K 1 1111111111 1
11011111100000000000N001 1 1 1 N 1 K K 1 1 1 K K 1 1 1
110000000000000000000001 1 1111111 1 C 1 D K K 1 C 1 1
111111111000000000000001 1 1 1BBB1 1 1 B1 1
111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */ /* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2023/10/26 16:50:23 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); mlx_close_window(vl->mlx);
return ; 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"); ft_putendl("H is pressed");
if (kd.modifier == MLX_SHIFT) if (kd.modifier == MLX_SHIFT)
vl->run = 2; vl->run = 2;
@ -124,7 +124,6 @@ void scrollhook(double xdelta, double ydelta, void *param)
ft_putendl("scroll down"); ft_putendl("scroll down");
} }
#include <stdio.h>
void cursorhook(double xpos, double ypos, void *param) void cursorhook(double xpos, double ypos, void *param)
{ {
t_varlist *vl; t_varlist *vl;

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */ /* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2023/10/26 17:33:50 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); return (NULL);
if (ft_strchr(" 0", line[x])) if (ft_strchr(" 0", line[x]))
map[y][x] = '0'; map[y][x] = '0';
else if (ft_strchr("1", line[x])) else if (line[x] == '1')
map[y][x] = '1'; map[y][x] = '1';
else if (ft_strchr("NESW", line[x])) else if (ft_strchr("NESW", line[x]))
map[y][x] = ft_setplayerpos(vl, line[x], y, 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++; x++;
} }
free(line); free(line);