fixed spawn position

This commit is contained in:
djonker 2023-11-03 23:26:03 +01:00
parent 64d1ff7ee9
commit 9a77da76d0
7 changed files with 90 additions and 12 deletions

15
maps/postestne.cub Normal file
View File

@ -0,0 +1,15 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
1111111
1 N1
1 1
1 1
1 1
1 1
1111111

15
maps/postestnw.cub Normal file
View File

@ -0,0 +1,15 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
1111111
1N 1
1 1
1 1
1 1
1 1
1111111

15
maps/postestse.cub Normal file
View File

@ -0,0 +1,15 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
1111111
1 1
1 1
1 1
1 1
1 N1
1111111

15
maps/postestsw.cub Normal file
View File

@ -0,0 +1,15 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
1111111
1 1
1 1
1 1
1 1
1N 1
1111111

15
maps/spritetest.cub Normal file
View File

@ -0,0 +1,15 @@
C 0,100,255
F 100,100,100
NO ./assets/bluestone.png
EA ./assets/colorstone.png
SO ./assets/redbrick.png
WE ./assets/wood.png
1111111
1B1B1B1
1 G G 1
1 1
1 N 1
1 1
1111111

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */
/* Updated: 2023/11/03 22:45:06 by houtworm ######## odam.nl */
/* Updated: 2023/11/03 23:17:11 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -19,11 +19,9 @@ mlx_texture_t *ft_selectsprite(t_varlist *vl, int type)
if (type == 1)
sprite = vl->barreltext;
else if (type == 2)
sprite = vl->hlamptext;
sprite = vl->slamptext;
else if (type == 3)
sprite = vl->hlamptext;
else if (type == 4)
sprite = vl->slamptext;
else
ft_errorexit("what?", "what?", 1);
return (sprite);

View File

@ -6,17 +6,18 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 17:33:50 by houtworm #+# #+# */
/* Updated: 2023/11/03 21:54:07 by houtworm ######## odam.nl */
/* Updated: 2023/11/03 23:25:15 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../cub3d.h"
#include <stdio.h>
char ft_setplayerpos(t_varlist *vl, char dir, int y, int x)
char ft_setplayerpos(t_varlist *vl, char dir, int x, int y)
{
vl->posx = x;
vl->posy = y;
printf("x: %d, y: %d\n", x, y);
vl->posx = x + 0.5;
vl->posy = y + 0.5;
if (dir == 'N')
{
vl->dirx = -1;
@ -99,14 +100,18 @@ char **ft_getmap(t_varlist *vl, int fd)
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] = ft_addsprite(vl, x, y, 2);
else if (line[x] == 'B')
map[y][x] = ft_addsprite(vl, x, y, 1);
else if (line[x] == 'X')
else if (line[x] == 'G')
map[y][x] = ft_addsprite(vl, x, y, 2);
else if (line[x] == 'H')
map[y][x] = ft_addsprite(vl, x, y, 3);
else if (line[x] == 'C')
map[y][x] = ft_addsprite(vl, x, y, 1);
else if (line[x] == 'X')
map[y][x] = ft_addsprite(vl, x, y, 1);
else if (line[x] == 'K')
map[y][x] = ft_addsprite(vl, x, y, 4);
map[y][x] = ft_addsprite(vl, x, y, 1);
else
{
ft_putstr("Invalid character on the map\n Valid options are\n");