예제 #1
0
        public FlappyBirdMainGameScene(string _name) : base(_name)
        {
            FlappyBirdProperties.Init();

            SEObject background = new SEObject("background");

            background.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("background-day"));
            background.GetComponent().GetTransformComponent().SetSize(SEProperties.GetGameWindowWidth(),
                                                                      SEProperties.GetGameWindowHeight());
            background.GetComponent().GetSpriteComponent().SetLayerDepth(1.0f);
            AddChild(background);

            bird = new Bird();
            AddChild(bird);

            obstacleManager = new ObstacleManager();
            AddChild(obstacleManager);

            Ground ground = new Ground();

            AddChild(ground);

            AddChild(FlappyBirdProperties.GetScoreLabel());
            AddChild(FlappyBirdProperties.GetHighScoreLabel());
            AddChild(FlappyBirdProperties.GetTextLabel());
        }
예제 #2
0
        protected override void Initialize()
        {
            base.Initialize();
#if DEBUG
            SEResourcesManager.LoadSprite(Content, @"UI\PNG\yellow_panel");
            SEResourcesManager.LoadSprite(Content, @"Debug\debug");
            SEResourcesManager.LoadSprite(Content, @"Debug\debug_2");
            SEResourcesManager.LoadSprite(Content, @"Debug\red_border");
            SEResourcesManager.LoadSprite(Content, @"Debug\circle_red");
#endif

            SEResourcesManager.LoadSprite(Content, "yellowbird-downflap");
            SEResourcesManager.LoadSprite(Content, "yellowbird-midflap");
            SEResourcesManager.LoadSprite(Content, "yellowbird-upflap");
            SEResourcesManager.LoadSprite(Content, "background-day");
            SEResourcesManager.LoadSprite(Content, "pipe-green");
            SEResourcesManager.LoadSprite(Content, "base");

            SEResourcesManager.LoadSprite(Content, @"UI\PNG\blue_button00");

            SEResourcesManager.LoadFont(Content, "PixelFontScore");
            SEResourcesManager.LoadFont(Content, "PixelFontText");
            SEResourcesManager.LoadFont(Content, "ButtonText");

            SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_die");
            SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_hit");
            SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_point");
            SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_swooshing");
            SEResourcesManager.LoadSound(Content, @"FlappyBird\sfx_wing");

            FlappyBirdMainGameScene flappyBirdScene = new FlappyBirdMainGameScene("flappyBirdScene");
            SESceneManager.AddScene(flappyBirdScene);
            SESceneManager.LoadScene(flappyBirdScene.GetName());
        }
        public SECircleColliderComponent() : base()
        {
            name = "circleColliderComponent";
#if DEBUG
            circleSprite = SEResourcesManager.GetSpriteByName(@"Debug\circle_red");
            UpdateRectangle();
#endif
        }
예제 #4
0
        static void Main()
        {
            SEResourcesManager.Init();
            SESceneManager.Init();

            using (var game = new FlappyBirdCore())
                game.Run();
        }
예제 #5
0
        public SEObject(string _name)
        {
            name              = _name;
            isEnable          = true;
            childs            = new List <SEObject>();
            component         = new SEComponent();
            dontDestroyOnLoad = false;
#if DEBUG
            showBorder = false;
            border     = SEResourcesManager.GetSpriteByName(@"Debug\red_border");
#endif
        }
예제 #6
0
        private void CreateNewGroundPart()
        {
            SEObject groundPart = new SEObject("ground");

            groundPart.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("base"));
            groundPart.GetComponent().GetTransformComponent().SetPosition(xPositionLastPart, FlappyBirdProperties.GetGroundHeigth());
            groundPart.GetComponent().GetTransformComponent().SetSize(SEProperties.GetGameWindowWidth(), (int)(SEProperties.GetGameWindowHeight() - FlappyBirdProperties.GetGroundHeigth()));
            groundPart.GetComponent().GetTransformComponent().SetRectangle(new Rectangle((int)xPositionLastPart,
                                                                                         (int)FlappyBirdProperties.GetGroundHeigth(),
                                                                                         SEProperties.GetGameWindowWidth(),
                                                                                         (int)(SEProperties.GetGameWindowHeight() - FlappyBirdProperties.GetGroundHeigth())));
            groundPart.GetComponent().GetSpriteComponent().SetLayerDepth(0.0f);

            groundPart.GetComponent().GetTransformComponent().SetSpeed(4f);
            AddChild(groundPart);
        }
예제 #7
0
        public Obstacle() : base("obstacle")
        {
            float shift = SEProperties.GetRandomizer().Next(0, 80);

            component.GetTransformComponent().SetSpeed(5.0f);
            bool isTopHigher = SEProperties.GetRandomizer().Next(0, 100) > 50 ? true : false;

            if (isTopHigher)
            {
                topHeight    += shift;
                bottmoHeight -= shift;
            }
            else
            {
                topHeight    -= shift;
                bottmoHeight += shift;
            }

            SEObject top = new SEObject("top");

            top.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("pipe-green"));
            top.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() + 50, 0);
            top.GetComponent().GetTransformComponent().SetSize(width, topHeight);
            top.GetComponent().GetTransformComponent().SetSpeed(5.0f);
            top.GetComponent().GetSpriteComponent().SetEffect(SpriteEffects.FlipVertically);
            top.GetComponent().GetSpriteComponent().SetLayerDepth(1.0f);

            SEObject bottom = new SEObject("bottom");

            bottom.GetComponent().GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("pipe-green"));
            bottom.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() + 50, SEProperties.GetGameWindowHeight() - bottmoHeight);
            bottom.GetComponent().GetTransformComponent().SetSize(width, bottmoHeight);
            bottom.GetComponent().GetTransformComponent().SetSpeed(5.0f);
            bottom.GetComponent().GetSpriteComponent().SetLayerDepth(1.0f);

            AddChild(top);
            AddChild(bottom);

            isActive = true;
        }
예제 #8
0
        public static void Init()
        {
            score     = 0;
            highScore = SerializationSystem.GetValue <int>("highScore.json");

            isBirdFly     = false;
            isGameWaiting = true;

            highScoreLabel = new SELabel(SEResourcesManager.GetFontByName("PixelFontScore"));
            highScoreLabel.GetComponent().GetFontComponent().SetText(highScore.ToString());
            highScoreLabel.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() / 2, SEProperties.GetGameWindowHeight() / 8);

            scoreLabel = new SELabel(SEResourcesManager.GetFontByName("PixelFontScore"));
            scoreLabel.GetComponent().GetFontComponent().SetText(score.ToString());
            scoreLabel.GetComponent().GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() / 2, SEProperties.GetGameWindowHeight() / 20);

            textLabel = new SELabel(SEResourcesManager.GetFontByName("PixelFontText"));
            textLabel.GetComponent().GetFontComponent().SetText("Tap on space to play game");
            textLabel.GetComponent().GetTransformComponent().SetPosition(150, 400);

            groundHeigth = 450;
        }
예제 #9
0
        public Bird() : base("bird")
        {
            scaleValue   = 1.4f;
            isFalling    = true;
            fallingSpeed = 5.0f;
            jumpSpeed    = 7.0f;

            component.GetSpriteComponent().SetSprite(SEResourcesManager.GetSpriteByName("yellowbird-downflap"));
            component.GetTransformComponent().SetPosition(SEProperties.GetGameWindowWidth() / 4, SEProperties.GetGameWindowHeight() / 2);
            component.GetTransformComponent().SetSize(component.GetSpriteComponent().GetSpriteWidth(),
                                                      component.GetSpriteComponent().GetSpriteHeight());
            component.GetTransformComponent().SetScale(scaleValue, scaleValue);
            component.GetTransformComponent().SetOriginRotatePosition(component.GetSpriteComponent().GetSpriteWidth() / 2, component.GetSpriteComponent().GetSpriteHeight() / 2);
            component.GetTransformComponent().SetSpeed(fallingSpeed);
            component.GetSpriteComponent().SetLayerDepth(0.1f);

            SESequentialChangeSprite changeSpriteAnim = new SESequentialChangeSprite(0.1f);

            changeSpriteAnim.AddSprite(SEResourcesManager.GetSpriteByName("yellowbird-midflap"));
            changeSpriteAnim.AddSprite(SEResourcesManager.GetSpriteByName("yellowbird-upflap"));
            changeSpriteAnim.AddSprite(SEResourcesManager.GetSpriteByName("yellowbird-downflap"));
            changeSpriteAnim.SetObject(this);
            component.GetActionComponent().AddAction("changeSprite", changeSpriteAnim);

            component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_die");
            component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_hit");
            component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_point");
            component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_swooshing");
            component.GetAudioSourceComponent().AddSound(@"FlappyBird\sfx_wing");
            component.GetAudioSourceComponent().SetVolume(0.1f);
            //component.GetAudioSourceComponent().SetVolume(0.0f);

            component.GetCircleColliderComponent().SetRadius(component.GetSpriteComponent().GetSpriteWidth() / 2);
            component.GetCircleColliderComponent().SetCenterPosition(component.GetTransformComponent().GetPosition().X,
                                                                     component.GetTransformComponent().GetPosition().Y);
        }
예제 #10
0
 public void AddSound(string soundName)
 {
     sounds.Add(soundName, SEResourcesManager.GetSoundByName(soundName));
 }