small tweaks
This commit is contained in:
parent
663de33fc0
commit
87eb97b21c
@ -13,6 +13,7 @@ Cub3D is a simple raycasting game using the mlx library
|
|||||||
- Minimap
|
- Minimap
|
||||||
- Animated Sprites
|
- Animated Sprites
|
||||||
### Extra
|
### Extra
|
||||||
|
- Help screen?
|
||||||
- Levels?
|
- Levels?
|
||||||
- Barrels?
|
- Barrels?
|
||||||
- Collectables
|
- Collectables
|
||||||
@ -20,7 +21,6 @@ Cub3D is a simple raycasting game using the mlx library
|
|||||||
- Moving Enemies?
|
- Moving Enemies?
|
||||||
- Weapon Sprite that fires?
|
- Weapon Sprite that fires?
|
||||||
- Zoom with right mouse button?
|
- Zoom with right mouse button?
|
||||||
- Help screen?
|
|
||||||
- Skybox?
|
- Skybox?
|
||||||
- Sounds?
|
- Sounds?
|
||||||
- Music?
|
- Music?
|
||||||
@ -45,6 +45,7 @@ Cub3D is a simple raycasting game using the mlx library
|
|||||||
- FPS counter
|
- FPS counter
|
||||||
- Player can walk in 8 directions
|
- Player can walk in 8 directions
|
||||||
- Player can Run
|
- Player can Run
|
||||||
|
- Map sizes up to 1 Megabyte (1000x1000)
|
||||||
|
|
||||||
---
|
---
|
||||||
## Bugs
|
## Bugs
|
||||||
|
@ -12,8 +12,8 @@ WE ./assets/wood.png
|
|||||||
1 1 1 1 1 1 1
|
1 1 1 1 1 1 1
|
||||||
1 11111111111 11111111111 111111111111111111111 1 1111111111 1111111111
|
1 11111111111 11111111111 111111111111111111111 1 1111111111 1111111111
|
||||||
1 1B C B1 1 1 1 1 1 D K K 1 1
|
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 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 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 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 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 K K D 1 1 K K D 1 1 1
|
||||||
|
18
src/keys.c
18
src/keys.c
@ -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 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");
|
ft_putendl("shoot");
|
||||||
if (mlx_is_key_down(vl->mlx, MLX_KEY_W))
|
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->posx += vl->dirx * vl->movespeed * vl->run;
|
||||||
vl->posy += vl->diry * 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->posx += vl->dirx * vl->movespeed * vl->run;
|
||||||
vl->posy += vl->diry * 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 (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->posx -= vl->diry * vl->movespeed * vl->run;
|
||||||
vl->posy += vl->dirx * 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->posx -= vl->diry * vl->movespeed * vl->run;
|
||||||
vl->posy += vl->dirx * 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 (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->posx -= vl->dirx * vl->movespeed * vl->run;
|
||||||
vl->posy -= vl->diry * 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->posx -= vl->dirx * vl->movespeed * vl->run;
|
||||||
vl->posy -= vl->diry * 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 (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->posx += vl->diry * vl->movespeed * vl->run;
|
||||||
vl->posy -= vl->dirx * 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->posx += vl->diry * vl->movespeed * vl->run;
|
||||||
vl->posy -= vl->dirx * vl->movespeed * vl->run;
|
vl->posy -= vl->dirx * vl->movespeed * vl->run;
|
||||||
|
14
src/map.c
14
src/map.c
@ -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 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 **map;
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
map = ft_calloc(512, 8);
|
map = ft_calloc(1024, 8);
|
||||||
y = 0;
|
y = 0;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
while (y <= 512 && ret > 0)
|
while (y <= 1024 && ret > 0)
|
||||||
{
|
{
|
||||||
if (y > 500)
|
if (y > 1000)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
map[y] = ft_calloc(512, 8);
|
map[y] = ft_calloc(1024, 8);
|
||||||
while (ret > 0)
|
while (ret > 0)
|
||||||
{
|
{
|
||||||
ret = get_next_line(fd, &line);
|
ret = get_next_line(fd, &line);
|
||||||
@ -77,9 +77,9 @@ char **ft_getmap(t_varlist *vl, int fd)
|
|||||||
return (map);
|
return (map);
|
||||||
}
|
}
|
||||||
x = 0;
|
x = 0;
|
||||||
while (x <= 512 && line[x])
|
while (x <= 1024 && line[x])
|
||||||
{
|
{
|
||||||
if (x > 500)
|
if (x > 1000)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (ft_strchr(" 0", line[x]))
|
if (ft_strchr(" 0", line[x]))
|
||||||
map[y][x] = '0';
|
map[y][x] = '0';
|
||||||
|
Loading…
Reference in New Issue
Block a user