Example #1
0
        protected override void Setup()
        {
            Title       = "";
            ButtonNames = new List <string>()
            {
                "Play",
                "How to Play",
                "Exit",
            };
            StripWidth         = Game.Size.X;
            StartY             = 800;
            ButtonDescriptions = new List <string>()
            {
            };
            ButtonHeight = 75;
            ButtonGap    = 150;
            HelpY        = 750;

            // Background
            if (Game.GraphicsMode == Game.GRAPHICSMODE_NORMAL)
            {
                Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                RectangleShape Water = new RectangleShape(new Vector2f(Game.Size.X, Game.Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(Game, new Vector2f(Game.Size.X + 40, Game.Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(Game, new Vector2f(Game.Size.X, Game.Size.Y), 120, 10, new Color(80, 158, 228));
                AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (Game.GraphicsMode == Game.GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect      = new IntRect(0, 0, (int)Game.Size.X, (int)Game.Size.Y);
                AddChild(BluePrintBackground);
            }
            Game.Resume();

            base.Setup();
            RemoveChild(Back);
            RemoveChild(Dim);

            // Title
            Sprite    title     = Graphics.GetSprite(Graphics.ASSETS_SPRITES + "gui/Title_Cannon_Island_Defence.png");
            FloatRect titleRect = title.GetLocalBounds();

            title.Position = new Vector2f((Game.Size.X - titleRect.Width) / 2, 100);
            AddChild(title);

            // Credits
            RectangleShape credits_back = new RectangleShape(new Vector2f(Game.Size.X, 40));

            credits_back.Position  = new Vector2f(0, Game.Size.Y - 40);
            credits_back.FillColor = new Color(0, 0, 0, 60);
            AddChild(credits_back);

            Text credit_corey = new Text("created by Corey Zeke Womack (torrunt.net)", Game.TidyHand, 24);

            credit_corey.Position = new Vector2f(5, Game.Size.Y - 35);
            AddChild(credit_corey);

            Text      credit_music = new Text("music by luigisounds.newgrounds.com", Game.TidyHand, 24);
            FloatRect textRect     = credit_music.GetLocalBounds();

            credit_music.Origin   = new Vector2f(textRect.Width, 0);
            credit_music.Position = new Vector2f(Game.Size.X - 5, Game.Size.Y - 35);
            AddChild(credit_music);
        }
Example #2
0
        protected override void Setup()
        {
            Title = "";
            ButtonNames = new List<string>()
            {
                "Play",
                "How to Play",
                "Exit",
            };
            StripWidth = Game.Size.X;
            StartY = 800;
            ButtonDescriptions = new List<string>() { };
            ButtonHeight = 75;
            ButtonGap = 150;
            HelpY = 750;

            // Background
            if (Game.GraphicsMode == Game.GRAPHICSMODE_NORMAL)
            {
                Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                RectangleShape Water = new RectangleShape(new Vector2f(Game.Size.X, Game.Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(Game, new Vector2f(Game.Size.X + 40, Game.Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(Game, new Vector2f(Game.Size.X, Game.Size.Y), 120, 10, new Color(80, 158, 228));
                AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (Game.GraphicsMode == Game.GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect = new IntRect(0, 0, (int)Game.Size.X, (int)Game.Size.Y);
                AddChild(BluePrintBackground);
            }
            Game.Resume();

            base.Setup();
            RemoveChild(Back);
            RemoveChild(Dim);

            // Title
            Sprite title = Graphics.GetSprite(Graphics.ASSETS_SPRITES + "gui/Title_Cannon_Island_Defence.png");
            FloatRect titleRect = title.GetLocalBounds();
            title.Position = new Vector2f((Game.Size.X - titleRect.Width) / 2, 100);
            AddChild(title);

            // Credits
            RectangleShape credits_back = new RectangleShape(new Vector2f(Game.Size.X, 40));
            credits_back.Position = new Vector2f(0, Game.Size.Y - 40);
            credits_back.FillColor = new Color(0, 0, 0, 60);
            AddChild(credits_back);

            Text credit_corey = new Text("created by Corey Zeke Womack (torrunt.net)", Game.TidyHand, 24);
            credit_corey.Position = new Vector2f(5, Game.Size.Y - 35);
            AddChild(credit_corey);

            Text credit_music = new Text("music by luigisounds.newgrounds.com", Game.TidyHand, 24);
            FloatRect textRect = credit_music.GetLocalBounds();
            credit_music.Origin = new Vector2f(textRect.Width, 0);
            credit_music.Position = new Vector2f(Game.Size.X - 5, Game.Size.Y - 35);
            AddChild(credit_music);
        }
Example #3
0
        public void Start()
        {
            if (Started)
                return;
            Started = true;
            Running = true;

            // Background
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                RectangleShape Water = new RectangleShape(new Vector2f(Size.X, Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                Layer_Background.AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(this, new Vector2f(Size.X + 40, Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                Layer_Background.AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(this, new Vector2f(Size.X, Size.Y), 120, 10, new Color(80, 158, 228));
                Layer_Background.AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect = new IntRect(0, 0, (int)Size.X, (int)Size.Y);
                Layer_Background.AddChild(BluePrintBackground);
            }

                // Island
            float IslandRadius = 240;

            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Sprite IslandTexture = Graphics.GetSprite("assets/sprites/island.png");
                IslandTexture.Origin = new Vector2f(IslandRadius, IslandRadius);
                IslandTexture.Position = new Vector2f((Size.X/2) + 1, (Size.Y/2));
                Layer_Background.AddChild(IslandTexture);
            }

            Island = new CircleShape(IslandRadius);
            Island.Origin = new Vector2f(IslandRadius, IslandRadius);
            Island.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Island.FillColor = new Color(0, 0, 10, 0);
                Island.OutlineThickness = 20;
                Island.OutlineColor = new Color(138, 104, 0, 100);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Island.FillColor = new Color(0, 0, 10, 30);
                Island.OutlineThickness = 2;
                Island.OutlineColor = new Color(250, 250, 250);
            }
            Island.SetPointCount(80);
            Layer_Background.AddChild(Island);

            IslandWaves = new CircleWaves(this, IslandRadius, 0.1f, 1.5f, 6, 80);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
                IslandWaves.Colour = new Color(80, 158, 228);
            IslandWaves.Position = Island.Position;
            Layer_Background.AddChild(IslandWaves);

                // Hill
            float HillRadius = 30;
            Hill = new CircleShape(HillRadius);
            Hill.Origin = new Vector2f(HillRadius, HillRadius);
            Hill.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Hill.FillColor = new Color(50, 50, 50, 150);
                Hill.OutlineThickness = 4;
                Hill.OutlineColor = new Color(0, 0, 0, 215);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Hill.FillColor = new Color(0, 0, 10, 50);
                Hill.OutlineThickness = 2;
                Hill.OutlineColor = new Color(250, 250, 250);
            }
            Hill.SetPointCount(50);
            Layer_Background.AddChild(Hill);

            // Player (Cannon)
            Player = new Cannon(this);
            Player.SetPosition(Size.X / 2, Size.Y / 2);
            Layer_OtherAbove.AddChild(Player);
            Player.SetPlayer(true);

            // AI Manager
            AIManager = new AIManager(this);
            AIManager.StartWaveCountdown();

            // HUD
            HUD = new HeadsUpDisplay(this);
            HUD.SetHealth(Player.Health);
            Layer_GUI.AddChild(HUD);
        }
Example #4
0
        public void Start()
        {
            if (Started)
            {
                return;
            }
            Started = true;
            Running = true;

            // Background
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                RectangleShape Water = new RectangleShape(new Vector2f(Size.X, Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                Layer_Background.AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(this, new Vector2f(Size.X + 40, Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                Layer_Background.AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(this, new Vector2f(Size.X, Size.Y), 120, 10, new Color(80, 158, 228));
                Layer_Background.AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect      = new IntRect(0, 0, (int)Size.X, (int)Size.Y);
                Layer_Background.AddChild(BluePrintBackground);
            }

            // Island
            float IslandRadius = 240;

            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Sprite IslandTexture = Graphics.GetSprite("assets/sprites/island.png");
                IslandTexture.Origin   = new Vector2f(IslandRadius, IslandRadius);
                IslandTexture.Position = new Vector2f((Size.X / 2) + 1, (Size.Y / 2));
                Layer_Background.AddChild(IslandTexture);
            }

            Island          = new CircleShape(IslandRadius);
            Island.Origin   = new Vector2f(IslandRadius, IslandRadius);
            Island.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Island.FillColor        = new Color(0, 0, 10, 0);
                Island.OutlineThickness = 20;
                Island.OutlineColor     = new Color(138, 104, 0, 100);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Island.FillColor        = new Color(0, 0, 10, 30);
                Island.OutlineThickness = 2;
                Island.OutlineColor     = new Color(250, 250, 250);
            }
            Island.SetPointCount(80);
            Layer_Background.AddChild(Island);

            IslandWaves = new CircleWaves(this, IslandRadius, 0.1f, 1.5f, 6, 80);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                IslandWaves.Colour = new Color(80, 158, 228);
            }
            IslandWaves.Position = Island.Position;
            Layer_Background.AddChild(IslandWaves);

            // Hill
            float HillRadius = 30;

            Hill          = new CircleShape(HillRadius);
            Hill.Origin   = new Vector2f(HillRadius, HillRadius);
            Hill.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Hill.FillColor        = new Color(50, 50, 50, 150);
                Hill.OutlineThickness = 4;
                Hill.OutlineColor     = new Color(0, 0, 0, 215);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Hill.FillColor        = new Color(0, 0, 10, 50);
                Hill.OutlineThickness = 2;
                Hill.OutlineColor     = new Color(250, 250, 250);
            }
            Hill.SetPointCount(50);
            Layer_Background.AddChild(Hill);

            // Player (Cannon)
            Player = new Cannon(this);
            Player.SetPosition(Size.X / 2, Size.Y / 2);
            Layer_OtherAbove.AddChild(Player);
            Player.SetPlayer(true);

            // AI Manager
            AIManager = new AIManager(this);
            AIManager.StartWaveCountdown();

            // HUD
            HUD = new HeadsUpDisplay(this);
            HUD.SetHealth(Player.Health);
            Layer_GUI.AddChild(HUD);
        }