removal(player): removed old angle code as it's incompatible with new methods

This commit is contained in:
Theo Champion 2025-07-29 15:02:40 +02:00
parent faf5127829
commit 2e1838e0bd

View file

@ -6,42 +6,11 @@
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */ /* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/24 14:41:35 by tchampio #+# #+# */ /* Created: 2025/07/24 14:41:35 by tchampio #+# #+# */
/* Updated: 2025/07/24 14:48:04 by tchampio ### ########.fr */ /* Updated: 2025/07/29 12:21:27 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../cub3d_data.h"
#include "../consts.h"
#include <math.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/X.h> #include <X11/X.h>
/* key parameter should be X's value such as XK_a */
void apply_angle(int key, t_cub3d_data *data)
{
double cos_angle;
double sin_angle;
cos_angle = cos(data->player.yaw);
sin_angle = sin(data->player.yaw);
if (key == XK_a)
{
data->player.x += cos_angle * MOVEMENT_SPEED;
data->player.y -= sin_angle * MOVEMENT_SPEED;
}
if (key == XK_d)
{
data->player.x -= cos_angle * MOVEMENT_SPEED;
data->player.y += sin_angle * MOVEMENT_SPEED;
}
if (key == XK_w)
{
data->player.x += sin_angle * MOVEMENT_SPEED;
data->player.y += cos_angle * MOVEMENT_SPEED;
}
if (key == XK_s)
{
data->player.x -= sin_angle * MOVEMENT_SPEED;
data->player.y -= cos_angle * MOVEMENT_SPEED;
}
}