You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bullet.rs
    path of file: ./repos/doukutsu-rs/src/game/weapon
    
    the code of the file until where you have to start completion: use num_traits::clamp;

use crate::common::{BulletFlag, Condition, Direction, Flag, Rect};
use crate::engine_constants::{BulletData, EngineConstants};
use crate::game::caret::CaretType;
use crate::game::npc::list::NPCList;
use crate::game::npc::NPC;
use crate::game::physics::{OFFSETS, PhysicalEntity};
use crate::game::player::{Player, TargetPlayer};
use crate::game::shared_game_state::{SharedGameState, TileSize};
use crate::game::stage::Stage;
use crate::util::rng::{RNG, Xoroshiro32PlusPlus, XorShift};

pub struct BulletManager {
    pub bullets: Vec<Bullet>,
    pub new_bullets: Vec<Bullet>,
    pub seeder: XorShift,
}

impl BulletManager {
    #[allow(clippy::new_without_default)]
    pub fn new() -> BulletManager {
        BulletManager {
            bullets: Vec::with_capacity(64),
            new_bullets: Vec::with_capacity(8),
            seeder: XorShift::new(0x359c482f),
        }
    }

    pub fn create_bullet(
        &mut self,
        x: i32,
        y: i32,
        btype: u16,
        owner: TargetPlayer,
        direction: Direction,
        constants: &EngineConstants,
    ) {
        let mut bullet = Bullet::new(x, y, btype, owner, direction, constants);
        bullet.rng = Xoroshiro32PlusPlus::new(self.seeder.next_u32());

        self.bullets.p
    
    fn tick_bubble_3(&mut self, state: &mut SharedGameState, players: [&Player; 2], new_bullets: &mut Vec<Bullet>) {
        let player = players[self.owner.index()];

        self.action_counter += 1;

        if self.action_counter > 100 || !player.controller.shoot() {
            self.cond.set_alive(false);
            state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
            state.sound_manager.play_sfx(100);

            match () {
                _ if player.up => {
                    new_bullets.push(Bullet::new(self.x, self.y, 22, self.owner, Direction::Up, &state.constants))
                }
                _ if player.down => {
                    new_bullets.push(Bullet::new(self.x, self.y, 22, self.owner, Direction::Bottom, &state.constants))
                }
                _ => new_bullets.push(Bullet::new(self.x, self.y, 22, self.owner, player.direction, &state.constants)),
            }
            return;
        }

        if self.action_num == 0 {
            self.action_num = 1;

            match self.direction {
                Direction::Left => {
                    self.vel_x = self.rng.range(-0x400..-0x200);
                    self.vel_y = (self.rng.range(-4..4) * 0x200) / 2;
                }
                Direction::Up => {
                    self.vel_y = self.rng.range(-0x400..-0x200);
                    self.vel_x = (self.rng.range(-4..4) * 0x200) / 2;
                }
                Direction::Right => {
                    self.vel_x = self.rng.range(0x200..0x400);
                    self.vel_y = (self.rng.range(-4..4) * 0x200) / 2;
                }
                Direction::Bottom => {
                    self.vel_y = self.rng.range(0x80..0x100);
                    self.vel_x = (self.rng.range(-4..4) * 0x200) / 2;
                }
                Direction::FacingPlayer => unreachable!(),
            }
        }

        self.vel_x += (player.x - self.x).signum() * 0x20;
        self.vel_y += (player.y - self.y).signum() * 0x20;

        if self.vel_x < 0 && self.flags.hit_left_wall() {
            self.vel_x = 0x400;
        }

        if self.vel_x > 0 && self.flags.hit_right_wall() {
            self.vel_x = -0x400;
        }

        if self.vel_y < 0 && self.flags.hit_top_wall() {
            self.vel_y = 0x400;
        }

        if self.vel_y > 0 && self.flags.hit_bottom_wall() {
            self.vel_y = -0x400;
        }

        self.x += self.vel_x;
        self.y += self.vel_y;

        self.anim_counter += 1;
        if self.anim_counter > 3 {
            self.anim_counter = 0;
            self.anim_num += 1;
            if self.anim_num > 3 {
                self.anim_num = 3;
            }
        }

        self.anim_rect = state.constants.weapon.bullet_rects.b021_bubble_l3[self.anim_num as usize];
    }