pub fn new(ctx: &mut Context, sprite_batch: SpriteBatch) -> Self {
        let mut pipe_tracker = pipe::PipeTracker::new();
        let atlas =
            atlas::Atlas::parse_atlas_json(std::path::Path::new("resources/texture_atlas.json"));
        let sound_player = Player::new(ctx);

        Self {
            tiles_drawn: false,
            pipes: GameState::create_start_entities(&atlas, &mut pipe_tracker),
            player: create_player(&atlas),
            tiles : create_tiles(&atlas),
            sprite_batch,
            pipe_tracker,
            play_state: PlayState::StartScreen,
            atlas,
            score: 0,
            best_score: 0,
            sound_player
        }
    }
/// Creates a new GameState
/// Panics if can't access the sprite image resource.
Creates a new GameState
Panics if can't access the sprite image resource.
Creates a new GameState Panics if can ' t access the sprite image resource .
pub fn new(ctx: &mut Context, sprite_batch: SpriteBatch) -> Self {
        let mut pipe_tracker = pipe::PipeTracker::new();
        let atlas =
            atlas::Atlas::parse_atlas_json(std::path::Path::new("resources/texture_atlas.json"));
        let sound_player = Player::new(ctx);
        Self {
            tiles_drawn: false,
            pipes: GameState::create_start_entities(&atlas, &mut pipe_tracker),
            player: create_player(&atlas),
            tiles : create_tiles(&atlas),
            sprite_batch,
            pipe_tracker,
            play_state: PlayState::StartScreen,
            atlas,
            score: 0,
            best_score: 0,
            sound_player
        }
    }
pub fn new ( ctx : & mut Context , sprite_batch : SpriteBatch ) -> Self { let mut pipe_tracker = pipe :: PipeTracker :: new ( ) ; let atlas = atlas :: Atlas :: parse_atlas_json ( std :: path :: Path :: new ( " " ) ) ; let sound_player = Player :: new ( ctx ) ; Self { tiles_drawn : false , pipes : GameState :: create_start_entities ( & atlas , & mut pipe_tracker ) , player : create_player ( & atlas ) , tiles : create_tiles ( & atlas ) , sprite_batch , pipe_tracker , play_state : PlayState :: StartScreen , atlas , score : 0 , best_score : 0 , sound_player } }
Creates a new GameState
Panics if can't access the sprite image resource.
Creates a new GameState Panics if can ' t access the sprite image resource .
ctx
&mut Context
sprite_batch
SpriteBatch
ctx
&mut Context
sprite_batch
SpriteBatch