aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_drawmap.c4
-rw-r--r--src/ft_key_events.c30
-rw-r--r--src/ft_print_list.c4
3 files changed, 17 insertions, 21 deletions
diff --git a/src/ft_drawmap.c b/src/ft_drawmap.c
index eac41ba..d5c545a 100644
--- a/src/ft_drawmap.c
+++ b/src/ft_drawmap.c
@@ -46,8 +46,8 @@ static void
static void
ft_draw_player(t_player *plist, t_cub *clist)
{
- const size_t x = plist->pos_x;
- const size_t y = plist->pos_y;
+ const float x = plist->pos_x;
+ const float y = plist->pos_y;
ft_drawsquare(40 + (x * 41), 40 + (y * 41), 0x009843fa, clist);
}
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index 3fbfc6f..da24f7e 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -22,13 +22,13 @@ static int
pl = clist->plist;
if (pl->view_side == 1)
- pl->pos_y -= 1;
+ pl->pos_y -= 0.4;
else if (pl->view_side == 2)
- pl->pos_x += 1;
+ pl->pos_x += 0.4;
else if (pl->view_side == 3)
- pl->pos_y += 1;
+ pl->pos_y += 0.4;
else if (pl->view_side == 4)
- pl->pos_x -= 1;
+ pl->pos_x -= 0.4;
ft_drawmap(clist);
return (0);
}
@@ -39,9 +39,9 @@ static int
t_player *pl;
pl = clist->plist;
- pl->view_side -= 1;
- if (pl->view_side == 0)
- pl->view_side = 4;
+ pl->view_side -= 1.0;
+ if (pl->view_side < 1.0)
+ pl->view_side = 4.0;
return (0);
}
@@ -51,14 +51,14 @@ static int
t_player *pl;
pl = clist->plist;
- if (pl->view_side == 1)
- pl->pos_y += 1;
+ if (pl->view_side >= 1)
+ pl->pos_y += 0.4;
else if (pl->view_side == 2)
- pl->pos_x -= 1;
+ pl->pos_x -= 0.4;
else if (pl->view_side == 3)
- pl->pos_y -= 1;
+ pl->pos_y -= 0.4;
else if (pl->view_side == 4)
- pl->pos_x += 1;
+ pl->pos_x += 0.4;
ft_drawmap(clist);
return (0);
}
@@ -69,9 +69,9 @@ static int
t_player *pl;
pl = clist->plist;
- pl->view_side += 1;
- if (pl->view_side == 5)
- pl->view_side = 1;
+ pl->view_side += 1.0;
+ if (pl->view_side > 4.0)
+ pl->view_side = 1.0;
return (0);
}
diff --git a/src/ft_print_list.c b/src/ft_print_list.c
index 5f59bc0..601a498 100644
--- a/src/ft_print_list.c
+++ b/src/ft_print_list.c
@@ -36,9 +36,5 @@ void
i++;
}
ft_printf("Map width -- [%zu]\n", clist->map_w);
- ft_printf("----\n");
- ft_printf("Player pos X [%zu]\n", clist->plist->pos_x);
- ft_printf("Player pos Y [%zu]\n", clist->plist->pos_y);
- ft_printf("Player view [%hhu]\n", clist->plist->view_side);
ft_printf("----------------------\n");
}