aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_sprite.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-24 19:08:03 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-24 19:08:03 +0100
commit7b7d5343c6042ce90ed213e967c34a07875e2e85 (patch)
tree0943f8592c6d480a85099750dbbd6b9b045e66eb /src/ft_get_sprite.c
parentBug fix, 1px bug is back (diff)
parentoy (diff)
download42-cub3d-7b7d5343c6042ce90ed213e967c34a07875e2e85.tar.gz
42-cub3d-7b7d5343c6042ce90ed213e967c34a07875e2e85.tar.bz2
42-cub3d-7b7d5343c6042ce90ed213e967c34a07875e2e85.tar.xz
42-cub3d-7b7d5343c6042ce90ed213e967c34a07875e2e85.tar.zst
42-cub3d-7b7d5343c6042ce90ed213e967c34a07875e2e85.zip
Merge branch 'sprites'
Diffstat (limited to 'src/ft_get_sprite.c')
-rw-r--r--src/ft_get_sprite.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c
index 43de290..806489f 100644
--- a/src/ft_get_sprite.c
+++ b/src/ft_get_sprite.c
@@ -17,8 +17,26 @@
void
ft_get_sprite_spawn(t_cub *clist)
{
+ size_t x;
+ size_t y;
- (void)clist;
+ x = 1;
+ y = 1;
+ while (clist->mlist->map[y])
+ {
+ while (clist->mlist->map[y][x])
+ {
+ if (ft_ischarset("2", clist->mlist->map[y][x]))
+ {
+ clist->sp_list.s_pos_x = x + 0.5;
+ clist->sp_list.s_pos_y = y + 0.5;
+ return ;
+ }
+ x++;
+ }
+ x = 1;
+ y++;
+ }
}
int8_t