/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* player_process.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dkaiser player; player->direction = get_direction_from_input(game); player->velocity.x = player->direction.x * PLAYER_MOVE_SPEED; player->velocity.y += 50; if (player->direction.y == -1 && is_on_floor( (t_collider){player->position, player->size}, &game->map)) player->velocity.y = -1000; move_and_slide(player, &game->map, game->mlx->delta_time); } static t_vector get_direction_from_input(t_game *game) { t_vector result; result.x = ((game->input_direction & RIGHT) != 0) - ((game->input_direction & LEFT) != 0); result.y = ((game->input_direction & DOWN) != 0) - ((game->input_direction & UP) != 0); return (result); }