mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
feat: Added shooting event
This commit is contained in:
parent
b0ac26a7f6
commit
d7781f44d2
2 changed files with 6 additions and 6 deletions
10
src/main.c
10
src/main.c
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/09/10 15:34:15 by tchampio ### ########.fr */
|
/* Updated: 2025/09/14 16:41:00 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -36,11 +36,10 @@
|
||||||
|
|
||||||
void handle_shooting(t_cub3d_data *data)
|
void handle_shooting(t_cub3d_data *data)
|
||||||
{
|
{
|
||||||
if (!data->keypresses.is_space_pressed)
|
if (data->keypresses.is_space_pressed)
|
||||||
return ;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
if (!data->player.weapon.is_auto)
|
||||||
|
data->keypresses.is_space_pressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,6 +52,7 @@ int game_loop(t_cub3d_data *data)
|
||||||
data->last_tick = get_milliseconds();
|
data->last_tick = get_milliseconds();
|
||||||
reset_matrix(data);
|
reset_matrix(data);
|
||||||
move_player(data);
|
move_player(data);
|
||||||
|
handle_shooting(data);
|
||||||
move_sprites(data);
|
move_sprites(data);
|
||||||
raycaster(data, &ray);
|
raycaster(data, &ray);
|
||||||
sprite_caster(data);
|
sprite_caster(data);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */
|
/* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/09/10 15:33:38 by tchampio ### ########.fr */
|
/* Updated: 2025/09/14 15:57:54 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue