public SpriteManager(ContentManager c, ScreenManager s)
        {
            isNetworkGame = false;
            screenManager = s;
            content = c;
            screenWidth = screenManager.GraphicsDevice.Viewport.Width;
            screenHeight = screenManager.GraphicsDevice.Viewport.Height;
            titleSafeLeft = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Left;
            titleSafeTop = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Top;
            titleSafeBottom = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Bottom;
            titleSafeRight = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Right;

            player = new UserControlledSprite(content.Load<Texture2D>(@"images\player1"),
            new Vector2(screenWidth / 2, screenHeight / 2),
            new Point(156, 128), 10, new Point(1, 1), new Point(4, 1), new Vector2(6, 6), 120);

            #if(XBOX360)
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 10),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 80),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 150),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            #else
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 30),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 100),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 170),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            #endif
        }
Beispiel #2
0
        public BattleMenuSprite(Texture2D textureImage, Vector2 position,
            Vector2 endPosition, Point frameSize, Point currentFrame, Point sheetSize,
            Vector2 speed, Point scale, float rotation, Color color, List<TowerSprite> towerList, Texture2D cursor,
            SpriteFont font)
            : base(textureImage, position, frameSize, Point.Zero, currentFrame,
            sheetSize, speed, null, 0, 1f, rotation, Vector2.Zero, color)
        {
            this.currentSpeed = speed;
            this.scrolling = false;
            this.endPosition = endPosition;
            this.scrollPosition = endPosition;
            this.startPosition = position;
            this.towerList = towerList;
            this.activeSelection = -1;
            this.selectedTower = -1;
            this.extended = false;
            this.scale = scale;
            this.font = font;
            this.active = false;

            base.frameSize = new Point((int)Math.Round((double)(textureImage.Width / (base.sheetSize.X + 1)) * this.scale.X), (int)Math.Round((double)(textureImage.Height / (base.sheetSize.Y + 1)) * this.scale.Y));
            base.origin = new Vector2(((textureImage.Width / (base.sheetSize.X + 1) / 2)), ((textureImage.Height / (base.sheetSize.Y + 1) / 2)));

            for (int counter = 0; counter < towerList.Count; counter++)
            {
                if (counter == 0)
                {
                    towerList[counter].SetPosition(new Vector2(this.position.X + towerList[counter].frameSize.X + 200, this.position.Y + (this.frameSize.Y / 2)));
                }
                else
                {
                    towerList[counter].SetPosition(new Vector2(towerList[counter - 1].GetPosition.X + 400, towerList[counter -1].GetPosition.Y));
                }
            }

            activeSelectionCursor = new UserControlledSprite(cursor, new Vector2(Int32.MinValue, Int32.MinValue),
                Point.Zero, new Point(0, 0), new Point(0, 0), Vector2.Zero, Color.White, 100);
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            // Load player
            Texture2D[] playerTextures = new Texture2D[5];
            playerTextures[0] = Game.Content.Load<Texture2D>(@"Test Images\bolt");
            playerTextures[1] = Game.Content.Load<Texture2D>(@"Test Images\plus");
            playerTextures[2] = Game.Content.Load<Texture2D>(@"Test Images\skullball");
            playerTextures[3] = Game.Content.Load<Texture2D>(@"Test Images\threeblades");
            playerTextures[4] = Game.Content.Load<Texture2D>(@"Test Images\threerings");
            Point[] playerFrameSizes = new Point[5];
            playerFrameSizes[0] = new Point(75, 75);
            playerFrameSizes[1] = new Point(75, 75);
            playerFrameSizes[2] = new Point(75, 75);
            playerFrameSizes[3] = new Point(75, 75);
            playerFrameSizes[4] = new Point(75, 75);
            Point[] playerSheetSizes = new Point[5];
            playerSheetSizes[0] = new Point(6, 8);
            playerSheetSizes[1] = new Point(6, 4);
            playerSheetSizes[2] = new Point(6, 8);
            playerSheetSizes[3] = new Point(6, 8);
            playerSheetSizes[4] = new Point(6, 8);
            player = new UserControlledSprite(playerTextures, new Vector2(200, 350),
                playerFrameSizes, 10, new Point(0, 0), playerSheetSizes,
                new Vector2(5, 0), null);

            base.LoadContent();
        }
        public SpriteManager(ContentManager c, ScreenManager s, NetworkManager nManager)
        {
            isNetworkGame = true;
            netManager = nManager;
            screenManager = s;
            content = c;
            screenWidth = screenManager.GraphicsDevice.Viewport.Width;
            screenHeight = screenManager.GraphicsDevice.Viewport.Height;
            titleSafeLeft = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Left;
            titleSafeTop = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Top;
            titleSafeBottom = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Bottom;
            titleSafeRight = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Right;

            if (isNetworkGame)
            {
                //if host, load your sprite on the left side, if not load it on the right
                if (netManager.netSession.IsHost)
                {
                    player = new UserControlledSprite(content.Load<Texture2D>(@"images\player1"),
                new Vector2(screenWidth / 4, screenHeight / 2),
                new Point(156, 128), 10, new Point(1, 1), new Point(4, 1), new Vector2(6, 6), 120);
                    netPlayer = new NetworkUserSprite(content.Load<Texture2D>(@"images\player2"),
                new Vector2(screenWidth * 3 / 4, screenHeight / 2),
                new Point(156, 128), 10, new Point(1, 1), new Point(1, 1), new Vector2(6, 6), 120);
                }
                else
                {
                    player = new UserControlledSprite(content.Load<Texture2D>(@"images\player1"),
                new Vector2(screenWidth * 3 / 4, screenHeight / 2),
                new Point(156, 128), 10, new Point(1, 1), new Point(4, 1), new Vector2(6, 6), 120);
                    netPlayer = new NetworkUserSprite(content.Load<Texture2D>(@"images\player2"),
                new Vector2(screenWidth / 4, screenHeight / 2),
                new Point(156, 128), 10, new Point(1, 1), new Point(1, 1), new Vector2(6, 6), 120);
                }

            }
            else
                player = new UserControlledSprite(content.Load<Texture2D>(@"images\player1"),
                new Vector2(screenWidth / 2, screenHeight / 2),
                new Point(156, 128), 10, new Point(1, 1), new Point(4, 1), new Vector2(6, 6), 120);

            #if(XBOX360)
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 10),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 80),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 150),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            #else
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 30),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 100),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 170),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            #endif
        }
Beispiel #5
0
        protected override void LoadContent()
        {
            mapUtil.LoadMapTextures();
            pathList = mapUtil.GeneratePath();
            mapList = mapUtil.GenerateMap(pathList);
            acidHit = Game.Content.Load<SoundEffect>(@"audio\splat");
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            Point startTile = new Point(Int32.MinValue, Int32.MinValue);
            desaturateEffect = Game.Content.Load<Effect>(@"effects\desaturate");

            projectileTextureList.Add("acid_bomb_projectile", Game.Content.Load<Texture2D>(@"images\acid_bomb_projectile"));
            towerTextureList.Add("tower", Game.Content.Load<Texture2D>(@"images\tower"));
            towerTextureList.Add("tower_", Game.Content.Load<Texture2D>(@"images\tower_"));
            fontList.Add("arial", Game.Content.Load<SpriteFont>(@"font\arial"));
            unitTextureList.Add("unit", Game.Content.Load<Texture2D>(@"Images/unit"));
            rangeTextureList.Add("circle", Game.Content.Load<Texture2D>(@"images/rangeCircle"));
            healthTextureList.Add("container", Game.Content.Load<Texture2D>(@"images/healthContainer"));
            healthTextureList.Add("bar", Game.Content.Load<Texture2D>(@"images/menuBackground"));
            filler = Game.Content.Load<Texture2D>(@"images\menuBackground");

            menuTowerList.Add(new TowerSprite(towerTextureList["tower"], new Vector2(Game.Window.ClientBounds.Width * 0.2f, -75),
                            new Point(5, 6), new Point(0, 0), new Point(10, 0), new Vector2(6, 6), 300, 0.4f, 300f, 400f, 10,
                            Color.White, projectileTextureList["acid_bomb_projectile"], rangeTextureList["circle"], 35, 100));

            menuTowerList.Add(new TowerSprite(towerTextureList["tower_"], new Vector2(Game.Window.ClientBounds.Width * 0.5f, -75),
                            new Point(-2, -5), new Point(0, 0), new Point(10, 0), new Vector2(6, 6), 300, 0.3f, 75f, 1000f, 10,
                            Color.White, projectileTextureList["acid_bomb_projectile"], rangeTextureList["circle"], 100, 100));

            menuTowerList.Add(new TowerSprite(towerTextureList["tower"], new Vector2(Game.Window.ClientBounds.Width * 0.8f, -75),
                            new Point(23, 20), new Point(0, 0), new Point(10, 0), new Vector2(6, 6), 300, 0.65f, 600f, 200f, 10,
                            Color.Green, projectileTextureList["acid_bomb_projectile"], rangeTextureList["circle"], 15, 100));

            battleMenuSprite = new BattleMenuSprite(filler, new Vector2(0, -150),
                new Vector2(0, 0), new Point(Game.Window.ClientBounds.Width, 150), new Point(0, 0), new Point(0, 0),
                new Vector2(0, 5), new Point((Game.Window.ClientBounds.Width / filler.Width), 150 / filler.Height), 0f, new Color(0, 0, 0, 100), menuTowerList,
                Game.Content.Load<Texture2D>(@"Images/cursor"), fontList["arial"]);

            towerMenuSprite = new BattleMenuSprite(filler, new Vector2(0, -150),
                new Vector2(0, 0), new Point(Game.Window.ClientBounds.Width, 150), new Point(0, 0), new Point(0, 0),
                new Vector2(0, 5), new Point((Game.Window.ClientBounds.Width / filler.Width), 150 / filler.Height), 0f, new Color(50, 50, 200, 100), menuTowerList,
                Game.Content.Load<Texture2D>(@"Images/cursor"), fontList["arial"]);

            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/cursor"),
                new Vector2(((Game1)Game).Window.ClientBounds.Width / 2, ((Game1)Game).Window.ClientBounds.Height / 2),
                new Point(0, 5), new Point(0, 0), new Point(0, 0), new Vector2(7, 7), 12, 1f, Color.White, 255);

            textList.Add("credits", new TextSprite(fontList["arial"], new Vector2(10, 10), new Vector2(0, 0), 0, "Credits: " + credits, Color.Beige));
            textList.Add("escaped", new TextSprite(fontList["arial"], new Vector2(Game.Window.ClientBounds.Width - 150, 10), new Vector2(0, 0), 0, "Escaped: " + unitsMissed, Color.Beige));

            base.LoadContent();
        }