Esempio n. 1
0
        public override void Update()
        {
            if (Input.KeyPressed(Key.Escape))
            {
                Game.Close();
            }

            credits.Scale = ((Game.WindowFullscreen) ? 1.0f : 2.0f);
            credits.X     = ((Game.WindowFullscreen) ? 250 : 1600);

            foreach (Light light in lights)
            {
                light.Update(Game.RealDeltaTime * 0.001f);
            }

            selection -= Convert.ToInt32(Global.PlayerOne.Controller.Up.Pressed) - Convert.ToInt32(Global.PlayerOne.Controller.Down.Pressed);
            selection  = (selection + (int)Choices.NUM) % (int)Choices.NUM;

            switch (selection)
            {
            case (int)Choices.PLAY:
                menuLight.entity = playButton;
                menuLight.SetOffset(175, 100);
                break;

            case (int)Choices.OPTIONS:
                menuLight.entity = howToButton;
                menuLight.SetOffset(240, 100);
                break;

            case (int)Choices.QUIT:
                menuLight.entity = quitButton;
                menuLight.SetOffset(175, 100);
                break;
            }

            if (Global.PlayerOne.Controller.Cross.Pressed)
            {
                switch (selection)
                {
                case (int)Choices.PLAY:
                    Game.SwitchScene(new Level());
                    break;

                case (int)Choices.OPTIONS:
                    Game.SwitchScene(new HowTo());
                    break;

                case (int)Choices.QUIT:
                    Game.Close();
                    break;
                }
            }

            Global.backgroundTimer += Game.DeltaTime;
            background.Shader.SetParameter("timer", Global.backgroundTimer);
        }
Esempio n. 2
0
        public MainMenu() : base(1920, 1080)
        {
            AddGraphic(background);
            background.Scroll = 0;
            AddGraphic(corners);

            credits.X = 250;
            credits.Y = 960;
            credits.CenterOrigin();
            AddGraphic(credits);

            lights.Clear();

            background.Shader = new Shader(ShaderType.Fragment, "assets/shaders/water_wave.frag");

            ambientLighting = new Surface(1920, 1080);
            lightSurface    = new Surface(1920, 1080);

            Add(new Logo(421, 542, "assets/gfx/logo.png"));

            // Play/How To/Quit buttons
            playButton  = Add(new Logo(1486, 440, "assets/gfx/play.png", 14.0f));
            howToButton = Add(new Logo(1544, 540, "assets/gfx/howto.png", 14.0f));
            quitButton  = Add(new Logo(1480, 640, "assets/gfx/quit.png", 14.0f));

            menuLight        = new Light(0, 0.1f);
            menuLight.entity = playButton;
            menuLight.SetAlpha(1.0f, 0.7f);
            menuLight.SetAlphaSpan(1.1f);
            menuLight.SetOffset(175, 100);
            lights.Add(menuLight);
        }
Esempio n. 3
0
        public MainMenu()
            : base(1920, 1080)
        {
            AddGraphic(background);
            background.Scroll = 0;
            AddGraphic(corners);

            credits.X = 250;
            credits.Y = 960;
            credits.CenterOrigin();
            AddGraphic(credits);

            lights.Clear();

            background.Shader = new Shader(ShaderType.Fragment, "assets/shaders/water_wave.frag");

            ambientLighting = new Surface(1920, 1080);
            lightSurface = new Surface(1920, 1080);

            Add(new Logo(421, 542, "assets/gfx/logo.png"));

            // Play/How To/Quit buttons
            playButton = Add(new Logo(1486, 440, "assets/gfx/play.png", 14.0f));
            howToButton = Add(new Logo(1544, 540, "assets/gfx/howto.png", 14.0f));
            quitButton = Add(new Logo(1480, 640, "assets/gfx/quit.png", 14.0f));

            menuLight = new Light(0, 0.1f);
            menuLight.entity = playButton;
            menuLight.SetAlpha(1.0f, 0.7f);
            menuLight.SetAlphaSpan(1.1f);
            menuLight.SetOffset(175, 100);
            lights.Add(menuLight);
        }
Esempio n. 4
0
        public FlyingGurnard(Entity target) : base(960, 540, 20, 10.0f)
        {
            // Initialize sprite
            sprite.CenterOrigin();
            Graphic = sprite;

            // Set the target
            this.target = target;

            // Set up hitbox (actually realized with the repel collider this hitbox is useless)
            SetHitbox(200, 200, -1);
            Hitbox.CenterOrigin();
            Hitbox.OriginX += hitboxOffset.X;
            Hitbox.OriginY += hitboxOffset.Y;

            // Make it so the player can't touch the enemy
            repelCollider.CenterOrigin();
            AddCollider(repelCollider);

            // Set up soft spots
            softSpot1.CenterOrigin();
            softSpot1.OriginX += softSpot1Offset.X;
            softSpot1.OriginY += softSpot1Offset.Y;

            softSpot2.CenterOrigin();
            softSpot2.OriginX += softSpot2Offset.X;
            softSpot2.OriginY += softSpot2Offset.Y;

            AddColliders(softSpot1, softSpot2);

            softlight1 = new Light();
            softlight1.SetAlpha(0.0f);
            softlight1.SetColor(new Color("C42679"));
            softlight1.SetRadius(300.0f);
            softlight1.SetOffset(softSpot1Offset);
            softlight1.entity = this;
            Level.lights.Add(softlight1);

            softlight2 = new Light();
            softlight2.SetAlpha(0.0f);
            softlight2.SetColor(new Color("C42679"));
            softlight2.SetRadius(300.0f);
            softlight2.SetOffset(softSpot2Offset);
            softlight2.entity = this;
            Level.lights.Add(softlight2);

            // Lights
            eye1 = new Light(0, 4.0f);
            eye1.SetAlpha(0.6f);
            eye1.SetRadius(100.0f);
            eye1offset = new Vector2(-170, 50);
            eye1.SetOffset(eye1offset);
            eye1.entity = this;
            Level.lights.Add(eye1);

            eye2 = new Light(0, 4.0f);
            eye2.SetAlpha(0.6f);
            eye2.SetRadius(100.0f);
            eye2offset = new Vector2(-170, -15);
            eye2.SetOffset(eye2offset);
            eye2.entity = this;
            Level.lights.Add(eye2);

            // Reset direction to right
            direction = new Vector2(0, 1);

            // Set max speed
            maxspeed = 30.0f;
        }
Esempio n. 5
0
 private void setOffset(ref Light light, Vector2 offset)
 {
     light.SetOffset(Util.Rotate(offset, sprite.Angle));
 }