diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-02 20:53:04 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-02 20:53:04 +0100 |
commit | b5db3b2ddc383fe66c4d7d00fd7cd1cfb5a9fe9c (patch) | |
tree | 693017c84746b288339617c068060142f05c786c /src/ft_key_events.c | |
parent | Removed useless printfs (diff) | |
download | 42-cub3d-b5db3b2ddc383fe66c4d7d00fd7cd1cfb5a9fe9c.tar.gz 42-cub3d-b5db3b2ddc383fe66c4d7d00fd7cd1cfb5a9fe9c.tar.bz2 42-cub3d-b5db3b2ddc383fe66c4d7d00fd7cd1cfb5a9fe9c.tar.xz 42-cub3d-b5db3b2ddc383fe66c4d7d00fd7cd1cfb5a9fe9c.tar.zst 42-cub3d-b5db3b2ddc383fe66c4d7d00fd7cd1cfb5a9fe9c.zip |
I can't turn
Diffstat (limited to '')
-rw-r--r-- | src/ft_key_events.c | 30 |
1 files changed, 15 insertions, 15 deletions
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); } |