<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osuTK;
using osuTK.Input;

namespace FlappyDon.Game
{
    /// <summary>
    /// The main game screen, where all screen
    /// elements are created, and key input from
    /// the player is used to drive current game state.
    /// </summary>
    public class GameScreen : DrawSizePreservingFillContainer
    {
        // Front-screen UI elements
        private readonly TitleSprite gameOverSprite = new TitleSprite("gameover");
        private readonly TitleSprite logoSprite = new TitleSprite("message");
        private readonly ScreenFlash screenFlash = new ScreenFlash();
        private readonly ScoreSpriteText scoreSpriteText = new ScoreSpriteText();

        // Game elements
        private readonly Bird bird = new Bird();
        private readonly Obstacles obstacles = new Obstacles();

        // Background elements
        private Backdrop skyBackdrop;
        private Backdrop groundBackdrop;

        // Sound effects
        private DrawableSample scoreSound;
        private DrawableSample punchSound;
        private DrawableSample fallSound;
        private DrawableSample whooshSound;

        // Game state
        private int score;
        private bool gameOver;
        private bool gameOverCooldown;

        [BackgroundDependencyLoader]
        private void load(ISampleStore samples)
        {
            // Load the sound effects
            AddInternal(scoreSound = new DrawableSample(samples.Get("point.ogg")));
            AddInternal(punchSound = new DrawableSample(samples.Get("hit.ogg")));
            AddInternal(fallSound = new DrawableSample(samples.Get("die.ogg")));
            AddInternal(whooshSound = new DrawableSample(samples.Get("swoosh.ogg")));

            // Create and configure the background elements
            skyBackdrop = new Backdrop(() => new BackdropSprite(), 20000.0f);
            groundBackdrop = new Backdrop(() => new GroundSprite(), 2250.0f);

            // Add all of the sprites to the game window
            Children = new Drawable[]
            {
                skyBackdrop,
                obstacles,
                bird,
                groundBackdrop,
                gameOverSprite,
                logoSprite,
                scoreSpriteText,
                screenFlash
            };

            // Configure the sizing stratgey to maxium as this
            // will preserve element sizing between tall portait
            // style screens (eg smartphones) and 4:3 screens (tablets)
            Strategy = DrawSizePreservationStrategy.Maximum;
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();

            // Set the Y offset from the top
            // that counts as the ground for the bird
            bird.GroundY = 525.0f;

            // Inform the obstacles the position of the
            // bird in order to detect when the player successfully
            // earns a pooint
            obstacles.BirdThreshold = bird.X;

            // Start animating the background elements<commit_msg>Fixed typo in game screen<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osuTK;
using osuTK.Input;

namespace FlappyDon.Game
{
    /// <summary>
    /// The main game screen, where all screen
    /// elements are created, and key input from
    /// the player is used to drive current game state.
    /// </summary>
    public class GameScreen : DrawSizePreservingFillContainer
    {
        // Front-screen UI elements
        private readonly TitleSprite gameOverSprite = new TitleSprite("gameover");
        private readonly TitleSprite logoSprite = new TitleSprite("message");
        private readonly ScreenFlash screenFlash = new ScreenFlash();
        private readonly ScoreSpriteText scoreSpriteText = new ScoreSpriteText();

        // Game elements
        private readonly Bird bird = new Bird();
        private readonly Obstacles obstacles = new Obstacles();

        // Background elements
        private Backdrop skyBackdrop;
        private Backdrop groundBackdrop;

        // Sound effects
        private DrawableSample scoreSound;
        private DrawableSample punchSound;
        private DrawableSample fallSound;
        private DrawableSample whooshSound;

        // Game state
        private int score;
        private bool gameOver;
        private bool gameOverCooldown;

        [BackgroundDependencyLoader]
        private void load(ISampleStore samples)
        {
            // Load the sound effects
            AddInternal(scoreSound = new DrawableSample(samples.Get("point.ogg")));
            AddInternal(punchSound = new DrawableSample(samples.Get("hit.ogg")));
            AddInternal(fallSound = new DrawableSample(samples.Get("die.ogg")));
            AddInternal(whooshSound = new DrawableSample(samples.Get("swoosh.ogg")));

            // Create and configure the background elements
            skyBackdrop = new Backdrop(() => new BackdropSprite(), 20000.0f);
            groundBackdrop = new Backdrop(() => new GroundSprite(), 2250.0f);

            // Add all of the sprites to the game window
            Children = new Drawable[]
            {
                skyBackdrop,
                obstacles,
                bird,
                groundBackdrop,
                gameOverSprite,
                logoSprite,
                scoreSpriteText,
                screenFlash
            };

            // Configure the sizing strategy to maximum as this
            // will preserve element sizing between tall portait
            // style screens (eg smartphones) and 4:3 screens (tablets)
            Strategy = DrawSizePreservationStrategy.Maximum;
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();

            // Set the Y offset from the top
            // that counts as the ground for the bird
            bird.GroundY = 525.0f;

            // Inform the obstacles the position of the
            // bird in order to detect when the player successfully
            // earns a pooint
            obstacles.BirdThreshold = bird.X;

            // Start animating the background elements
{'fraction_non_alphanumeric': 0.07446342531756461, 'fraction_numerical': 0.004964228354504307, 'mean_word_length': 2.1122217174011815, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3959550', 'n_tokens_mistral': 1687, 'n_tokens_neox': 1636, 'n_words': 561}