aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_events.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-10 18:37:19 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-10 18:37:19 +0100
commit55bc5cc3a5578acb1779cbc181d5b90baa5b3210 (patch)
treebd8e5b0c5e78a7f31650a0e3f55fc477f7aa84b7 /src/ft_key_events.c
parentnew file (diff)
download42-cub3d-55bc5cc3a5578acb1779cbc181d5b90baa5b3210.tar.gz
42-cub3d-55bc5cc3a5578acb1779cbc181d5b90baa5b3210.tar.bz2
42-cub3d-55bc5cc3a5578acb1779cbc181d5b90baa5b3210.tar.xz
42-cub3d-55bc5cc3a5578acb1779cbc181d5b90baa5b3210.tar.zst
42-cub3d-55bc5cc3a5578acb1779cbc181d5b90baa5b3210.zip
eqwqyeuqwrqwreqrq
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r--src/ft_key_events.c56
1 files changed, 10 insertions, 46 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index d400684..5ca3d36 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -21,26 +21,8 @@ static int
t_player *pl;
pl = clist->plist;
- if (pl->view_side == 1)
- {
- if ((pl->pos_y -= 0.3) < 0.4)
- pl->pos_y = 0.4;
- }
- else if (pl->view_side == 2)
- {
- if ((pl->pos_x += 0.3) > clist->map_w - 0.4)
- pl->pos_x = clist->map_w - 0.4;
- }
- else if (pl->view_side == 3)
- {
- if ((pl->pos_y += 0.3) > clist->map_h - 0.4)
- pl->pos_y = clist->map_h - 0.4;
- }
- else if (pl->view_side == 4)
- {
- if ((pl->pos_x -= 0.3) < 0.4)
- pl->pos_x = 0.4;
- }
+ if ((pl->pos_y -= 0.3) < 0.4)
+ pl->pos_y = 0.4;
ft_drawmap(clist);
return (0);
}
@@ -51,9 +33,9 @@ static int
t_player *pl;
pl = clist->plist;
- pl->view_side -= 1.0;
- if (pl->view_side < 1.0)
- pl->view_side = 4.0;
+ if ((pl->pos_x -= 0.3) < 0.4)
+ pl->pos_x = 0.4;
+ ft_drawmap(clist);
return (0);
}
@@ -63,26 +45,8 @@ static int
t_player *pl;
pl = clist->plist;
- if (pl->view_side == 1)
- {
- if ((pl->pos_y += 0.3) > clist->map_h - 0.4)
- pl->pos_y = clist->map_h - 0.4;
- }
- else if (pl->view_side == 2)
- {
- if ((pl->pos_x -= 0.3) < 0.4)
- pl->pos_x = 0.4;
- }
- else if (pl->view_side == 3)
- {
- if ((pl->pos_y -= 0.3) < 0.4)
- pl->pos_y = 0.4;
- }
- else if (pl->view_side == 4)
- {
- if ((pl->pos_x += 0.3) > clist->map_w - 0.4)
- pl->pos_x = clist->map_w - 0.4;
- }
+ if ((pl->pos_y += 0.3) > clist->map_h - 0.4)
+ pl->pos_y = clist->map_h - 0.4;
ft_drawmap(clist);
return (0);
}
@@ -93,9 +57,9 @@ static int
t_player *pl;
pl = clist->plist;
- pl->view_side += 1.0;
- if (pl->view_side > 4.0)
- pl->view_side = 1.0;
+ if ((pl->pos_x += 0.3) > clist->map_w - 0.4)
+ pl->pos_x = clist->map_w - 0.4;
+ ft_drawmap(clist);
return (0);
}