66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
#include "cube3d.h"
|
|
|
|
void plr_posx_decrement(t_game *game)
|
|
{
|
|
double pos_x;
|
|
double pos_y;
|
|
|
|
pos_x = game->plr_exact_x - 5;
|
|
pos_y = game->plr_exact_y;
|
|
rotate_double(game, &pos_x, &pos_y);
|
|
if (plr_out_limits(game, pos_x, pos_y))
|
|
return ;
|
|
game->plr_exact_x = pos_x;
|
|
game->plr_exact_y = pos_y;
|
|
(game->plr_x) = (int)pos_x;
|
|
(game->plr_y) = (int)pos_y;
|
|
}
|
|
|
|
void plr_posy_decrement(t_game *game)
|
|
{
|
|
double pos_x;
|
|
double pos_y;
|
|
|
|
pos_x = game->plr_exact_x;
|
|
pos_y = game->plr_exact_y - 5;
|
|
rotate_double(game, &pos_x, &pos_y);
|
|
if (plr_out_limits(game, pos_x, pos_y))
|
|
return ;
|
|
game->plr_exact_x = pos_x;
|
|
game->plr_exact_y = pos_y;
|
|
(game->plr_x) = (int)pos_x;
|
|
(game->plr_y) = (int)pos_y;
|
|
}
|
|
|
|
void plr_posx_increment(t_game *game)
|
|
{
|
|
double pos_x;
|
|
double pos_y;
|
|
|
|
pos_x = game->plr_exact_x + 5;
|
|
pos_y = game->plr_exact_y;
|
|
rotate_double(game, &pos_x, &pos_y);
|
|
if (plr_out_limits(game, pos_x, pos_y))
|
|
return ;
|
|
game->plr_exact_x = pos_x;
|
|
game->plr_exact_y = pos_y;
|
|
(game->plr_x) = (int)pos_x;
|
|
(game->plr_y) = (int)pos_y;
|
|
}
|
|
|
|
void plr_posy_increment(t_game *game)
|
|
{
|
|
double pos_x;
|
|
double pos_y;
|
|
|
|
pos_x = game->plr_exact_x;
|
|
pos_y = game->plr_exact_y + 5;
|
|
rotate_double(game, &pos_x, &pos_y);
|
|
if (plr_out_limits(game, pos_x, pos_y))
|
|
return ;
|
|
game->plr_exact_x = pos_x;
|
|
game->plr_exact_y = pos_y;
|
|
(game->plr_x) = (int)pos_x;
|
|
(game->plr_y) = (int)pos_y;
|
|
}
|