small tweaks

This commit is contained in:
djonker 2023-10-29 22:32:27 +01:00
parent 663de33fc0
commit 87eb97b21c
4 changed files with 20 additions and 19 deletions

View File

@ -13,6 +13,7 @@ Cub3D is a simple raycasting game using the mlx library
- Minimap
- Animated Sprites
### Extra
- Help screen?
- Levels?
- Barrels?
- Collectables
@ -20,7 +21,6 @@ Cub3D is a simple raycasting game using the mlx library
- Moving Enemies?
- Weapon Sprite that fires?
- Zoom with right mouse button?
- Help screen?
- Skybox?
- Sounds?
- Music?
@ -45,6 +45,7 @@ Cub3D is a simple raycasting game using the mlx library
- FPS counter
- Player can walk in 8 directions
- Player can Run
- Map sizes up to 1 Megabyte (1000x1000)
---
## Bugs

View File

@ -12,8 +12,8 @@ WE ./assets/wood.png
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 1 K K 1 1 K K D 1 C 1 K K D 1 1 K K K K K K K K 1
1 1 1 1 1 1 1 1 1111111111 K K 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

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 16:50:23 by houtworm #+# #+# */
/* Updated: 2023/10/29 18:57:04 by houtworm ######## odam.nl */
/* Updated: 2023/10/29 19:33:50 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -26,12 +26,12 @@ void ft_movementkeys(t_varlist *vl)
ft_putendl("shoot");
if (mlx_is_key_down(vl->mlx, MLX_KEY_W))
{
if (vl->map[(int)(vl->posx + vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.5)
if (vl->map[(int)(vl->posx + vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx += vl->dirx * vl->movespeed * vl->run;
vl->posy += vl->diry * vl->movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy + vl->diry * vl->movespeed)] == '0' && distance > 0.5)
if (vl->map[(int)vl->posx][(int)(vl->posy + vl->diry * vl->movespeed)] == '0' && distance > 0.4)
{
vl->posx += vl->dirx * vl->movespeed * vl->run;
vl->posy += vl->diry * vl->movespeed * vl->run;
@ -39,12 +39,12 @@ void ft_movementkeys(t_varlist *vl)
}
if (mlx_is_key_down(vl->mlx, MLX_KEY_A))
{
if (vl->map[(int)(vl->posx - vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.5)
if (vl->map[(int)(vl->posx - vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx -= vl->diry * vl->movespeed * vl->run;
vl->posy += vl->dirx * vl->movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy - vl->diry * vl->movespeed)] == '0' && distance > 0.5)
if (vl->map[(int)vl->posx][(int)(vl->posy - vl->diry * vl->movespeed)] == '0' && distance > 0.4)
{
vl->posx -= vl->diry * vl->movespeed * vl->run;
vl->posy += vl->dirx * vl->movespeed * vl->run;
@ -52,12 +52,12 @@ void ft_movementkeys(t_varlist *vl)
}
if (mlx_is_key_down(vl->mlx, MLX_KEY_S))
{
if (vl->map[(int)(vl->posx - vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.5)
if (vl->map[(int)(vl->posx - vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx -= vl->dirx * vl->movespeed * vl->run;
vl->posy -= vl->diry * vl->movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy - vl->diry * vl->movespeed)] == '0' && distance > 0.5)
if (vl->map[(int)vl->posx][(int)(vl->posy - vl->diry * vl->movespeed)] == '0' && distance > 0.4)
{
vl->posx -= vl->dirx * vl->movespeed * vl->run;
vl->posy -= vl->diry * vl->movespeed * vl->run;
@ -65,12 +65,12 @@ void ft_movementkeys(t_varlist *vl)
}
if (mlx_is_key_down(vl->mlx, MLX_KEY_D))
{
if (vl->map[(int)(vl->posx + vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.5)
if (vl->map[(int)(vl->posx + vl->dirx * vl->movespeed)][(int)vl->posy] == '0' && distance > 0.4)
{
vl->posx += vl->diry * vl->movespeed * vl->run;
vl->posy -= vl->dirx * vl->movespeed * vl->run;
}
if (vl->map[(int)vl->posx][(int)(vl->posy + vl->diry * vl->movespeed)] == '0' && distance > 0.5)
if (vl->map[(int)vl->posx][(int)(vl->posy + vl->diry * vl->movespeed)] == '0' && distance > 0.4)
{
vl->posx += vl->diry * vl->movespeed * vl->run;
vl->posy -= vl->dirx * vl->movespeed * vl->run;

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 17:33:50 by houtworm #+# #+# */
/* Updated: 2023/10/29 17:53:01 by houtworm ######## odam.nl */
/* Updated: 2023/10/29 19:30:54 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -56,14 +56,14 @@ char **ft_getmap(t_varlist *vl, int fd)
char **map;
char *line;
map = ft_calloc(512, 8);
map = ft_calloc(1024, 8);
y = 0;
ret = 1;
while (y <= 512 && ret > 0)
while (y <= 1024 && ret > 0)
{
if (y > 500)
if (y > 1000)
return (NULL);
map[y] = ft_calloc(512, 8);
map[y] = ft_calloc(1024, 8);
while (ret > 0)
{
ret = get_next_line(fd, &line);
@ -77,9 +77,9 @@ char **ft_getmap(t_varlist *vl, int fd)
return (map);
}
x = 0;
while (x <= 512 && line[x])
while (x <= 1024 && line[x])
{
if (x > 500)
if (x > 1000)
return (NULL);
if (ft_strchr(" 0", line[x]))
map[y][x] = '0';