コード例 #1
0
 public HealthBar(Vector2 Center)
 {
     red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f);
     red.Color = Color.Red;
     green = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f);
     green.Color = Color.Green;
 }
コード例 #2
0
 public Obstacle(Hero hero, List<Enemy> enemies, Vector2 center, float width, float height)
 {
     this.hero = hero;
     this.enemies = enemies;
     this.box = new XNACS1Rectangle(center, width, height);
     this.box.Color = Color.SlateGray;
 }
コード例 #3
0
ファイル: Fan.cs プロジェクト: AntMartz/fat-cats-final
        public override void RemoveFromAutoDrawSet()
        {
            this.areaOfEffect.RemoveFromAutoDrawSet();
            this.areaOfEffect = null;

            base.RemoveFromAutoDrawSet();
        }
コード例 #4
0
        public void Update(Vector2 Center, int health, int maxHealth)
        {
            if (red != null && green != null) {
                red.RemoveFromAutoDrawSet();
                green.RemoveFromAutoDrawSet();
                red = null;
                green = null;
            }

            if(health >= (maxHealth * .7)) {
                red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f);
                red.Color = Color.Red;
                green = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f);
                green.Color = Color.Green;
            }
            else if(health >= (maxHealth * .4)) {
                red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f);
                red.Color = Color.Red;
                green = new XNACS1Rectangle(new Vector2(Center.X - 1, Center.Y + 3), 2, 0.5f);
                green.Color = Color.Green;
            }
            else if(health > 0){
                red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f);
                red.Color = Color.Red;
                green = new XNACS1Rectangle(new Vector2(Center.X - 2, Center.Y + 3), 1, 0.5f);
                green.Color = Color.Green;
            }
        }
コード例 #5
0
        public RemoveComponentMenu()
        {
            float screenWidth = XNACS1Base.World.WorldDimension.X;
            float screenHeight = XNACS1Base.World.WorldDimension.Y;
            Vector2 screenCenter = XNACS1Base.World.WorldDimension / 2;

            Vector2 removeCenter = screenCenter + new Vector2(0, screenHeight * 0.1f);
            Vector2 cancelCenter = screenCenter - new Vector2(0, screenHeight * 0.1f);
            Vector2 spinLeftCenter = screenCenter - new Vector2(screenWidth * 0.1f, 0);
            Vector2 spinRightCenter = screenCenter + new Vector2(screenWidth * 0.1f, 0);

            this.background = new XNACS1Rectangle(screenCenter, screenWidth, screenHeight);
            this.background.Visible = false;
            this.background.Color = Color.Black;

            this.remove = new XNACS1Rectangle(removeCenter, screenWidth * 0.8f, screenHeight * 0.1f);
            this.remove.Visible = false;
            this.remove.Color = Color.White;
            this.remove.Label = "Remove";

            this.cancel = new XNACS1Rectangle(cancelCenter, screenWidth * 0.8f, screenHeight * 0.1f);
            this.cancel.Visible = false;
            this.cancel.Color = Color.White;
            this.cancel.Label = "Return to Game";

            this.spinLeft = new XNACS1Rectangle(spinLeftCenter, screenHeight * 0.1f, screenHeight * 0.1f, "rotateLeft");
            this.spinLeft.Visible = false;

            this.spinRight = new XNACS1Rectangle(spinRightCenter, screenHeight * 0.1f, screenHeight * 0.1f, "rotateRight");
            this.spinRight.Visible = false;
        }
コード例 #6
0
 public OverHeatWeapon(Hero hero)
     : base(hero)
 {
     overheated = false;
     currentHeatLevel = 0;
     tempTracker = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 4, GameWorld.topEdge - 4), 4, 4);
 }
コード例 #7
0
        private LevelSelectButton[] buttons; // an array to hold the menu buttons.

        #endregion Fields

        #region Constructors

        public LevelSelect()
        {
            background = new XNACS1Rectangle();
            background.Texture = "mainMenuBackground";

            buttons = new LevelSelectButton[5];

            buttons[0] = new LevelSelectButton(LevelSelectButton.LevelSelectPress.level1);
            buttons[0].Texture = "menuButton";
            buttons[0].Label = "Level 1";
            buttons[0].LabelColor = Color.Black;

            buttons[1] = new LevelSelectButton(LevelSelectButton.LevelSelectPress.level2);
            buttons[1].Texture = "menuButton";
            buttons[1].Label = "Level 2";
            buttons[1].LabelColor = Color.Black;

            buttons[2] = new LevelSelectButton(LevelSelectButton.LevelSelectPress.level3);
            buttons[2].Texture = "menuButton";
            buttons[2].Label = "Level 3";
            buttons[2].LabelColor = Color.Black;

            buttons[3] = new LevelSelectButton(LevelSelectButton.LevelSelectPress.level4);
            buttons[3].Texture = "menuButton";
            buttons[3].Label = "Level 4";
            buttons[3].LabelColor = Color.Black;

            buttons[4] = new LevelSelectButton(LevelSelectButton.LevelSelectPress.returnToMain);
            buttons[4].Texture = "menuButton";
            buttons[4].Label = "Main Menu";
            buttons[4].LabelColor = Color.Black;

            this.Hide();
        }
コード例 #8
0
ファイル: MainMenu.cs プロジェクト: AntMartz/fat-cats-final
        public MainMenu()
        {
            background = new XNACS1Rectangle();
            background.Texture = "mainMenuBackground";

            nameBanner = new XNACS1Rectangle();
            nameBanner.Texture = "mainMenuBanner";

            buttons = new MainMenuButton[4];

            buttons[0] = new MainMenuButton(MainMenuButton.MenuPress.levelSelect);
            buttons[0].Texture = "menuButton";
            buttons[0].Label = "Play Game";
            buttons[0].LabelColor = Color.Black;

            buttons[1] = new MainMenuButton(MainMenuButton.MenuPress.credits);
            buttons[1].Texture = "menuButton";
            buttons[1].Label = "Credits";
            buttons[1].LabelColor = Color.Black;

            buttons[2] = new MainMenuButton(MainMenuButton.MenuPress.exitGame);
            buttons[2].Texture = "menuButton";
            buttons[2].Label = "Quit Game";
            buttons[2].LabelColor = Color.Black;

            buttons[3] = new MainMenuButton(MainMenuButton.MenuPress.kelvinMode);
            buttons[3].Label = "";
            buttons[3].LabelColor = Color.Black;

            this.Hide();
        }
コード例 #9
0
        public Debris(Hero hero, List<Enemy> enemies, float minX, float maxX)
        {
            float padding = size;

            float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding);
            float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding);
            texture = new XNACS1Rectangle(new Vector2(randomX, randomY), size, size);

            switch (XNACS1Base.RandomInt(3)) {
                case 0:
                    texture.Texture = "Beak";
                    break;

                case 1:
                    texture.Texture = "Window";
                    break;

                case 2:
                    texture.Texture = "Wing2";
                    texture.Width = texture.Height * 1.8f;
                    break;
            }

            obstacle = new Obstacle(hero, enemies, texture.Center, texture.Width * .9f, texture.Height * .9f);
        }
        protected override void InitializeWorld()
        {
            //XNACS1Base.SetAppWindowPixelDimension(false, 1250, 300);
            World.SetWorldCoordinate(new Vector2(0f, 0f), 100f);
            totalLevels = 1;
            path = @"level0.txt";	//this works if world1.txt is in the bin/x86/debug folder
            try {
            s = new StreamReader(path);

            theLevel = new Level(ref s);

            }
            catch (Exception e) {
            // Let the user know what went wrong.
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(e.Message);
            }

            currentLevel = 0;
            //levelSet[currentLevel].loadInitialRoom(); -- Moved this down to where the game starts after menu
            World.SetWorldCoordinate(new Vector2(0, 0), 100f);

            paused = gameStarted = gameOver = false;

            selected = new XNACS1Rectangle(new Vector2(50, 30), 42, 10);
            selected.Color = Color.Red;

            easy = new XNACS1Rectangle(new Vector2(50, 45), 40, 8, "easy");
            medium = new XNACS1Rectangle(new Vector2(50, 30), 40, 8, "medium");
            hard = new XNACS1Rectangle(new Vector2(50, 15), 40, 8, "hard");
        }
        public void InitializeWalls()
        {
            Vector2 RoomCenter = new Vector2(roomMin.X + 100f/2f, roomMin.Y + ((9f/16f)*100f - 4.5f)/2f);

            // left wall
            RoomWalls[0] = new XNACS1Rectangle(new Vector2(roomMin.X + 1.25f, RoomCenter.Y), 2.5f, roomMax.Y - roomMin.Y - 4.5f);
            allWalls.AddToSet(RoomWalls[0]);
            RoomWalls[0].Texture = "leftWall";
            // top wall
            RoomWalls[1] = new XNACS1Rectangle(new Vector2(RoomCenter.X, roomMax.Y - 4.25f - 1.25f), roomMax.X -roomMin.X, 2.5f);
            allWalls.AddToSet(RoomWalls[1]);
            RoomWalls[1].Texture = "topWall";
            // right wall
            RoomWalls[2] = new XNACS1Rectangle(new Vector2(roomMax.X - 1.25f, RoomCenter.Y), 2.5f, roomMax.Y - roomMin.Y - 4.5f);
            allWalls.AddToSet(RoomWalls[2]);
            RoomWalls[2].Texture = "leftWall";
            // bottom wall
            RoomWalls[3] = new XNACS1Rectangle(new Vector2(RoomCenter.X, roomMin.Y + 1.25f), roomMax.X - roomMin.X, 2.5f);
            allWalls.AddToSet(RoomWalls[3]);
            RoomWalls[3].Texture = "topWall";
            DisplayWall = new XNACS1Rectangle(new Vector2(RoomCenter.X, roomMax.Y - 1.9f), roomMax.X-roomMin.X, 4.5f);
            DisplayWall.TopOfAutoDrawSet();
            DisplayWall.Color = Color.Black;
            allWalls.AddToSet(DisplayWall);
        }
コード例 #12
0
ファイル: HudBar.cs プロジェクト: AntMartz/fat-cats-final
        public HudBar(int screenWidth, int screenHeight)
        {
            _screenWidth = screenWidth;
            _screenHeight = screenHeight;
            ticksInLevel = 0;

            #region Current state and menu inits.
            this.currentState = InGameMenuState.noMenu;

            // create a RemoveComponentMenu
            removeMenu = new RemoveComponentMenu();

            // create an AddComponentMenu
            addMenu = new AddComponentMenu();
            #endregion

            #region HUD creation
            hudBackground = new XNACS1Rectangle(    new Vector2(XNACS1Base.World.WorldMin.X + XNACS1Base.World.WorldDimension.X / 2,
                                                    XNACS1Base.World.WorldMax.Y - (XNACS1Base.World.WorldDimension.Y * hudSize / 2)),
                                                    XNACS1Base.World.WorldDimension.X,
                                                    XNACS1Base.World.WorldDimension.Y * hudSize);

            // components is left most button.
            componentsButton = new XNACS1Rectangle(new Vector2(hudBackground.CenterX - (hudBackground.Width / 2) + (hudBackground.Width * buttonSize * .5f), hudBackground.CenterY),
                                                    hudBackground.Width * buttonSize, hudBackground.Height);
            componentsButton.Texture = "componentButton";
            //componentsButton.Label = "components";

            // coins is second from left.
            coinsRemaining = new XNACS1Rectangle(new Vector2(hudBackground.CenterX - (hudBackground.Width / 2) + 3 * (hudBackground.Width * buttonSize * .5f), hudBackground.CenterY),
                                                    hudBackground.Width * buttonSize, hudBackground.Height);
            coinsRemaining.Label = "0000";

            // go/stop button is in middle.
            goStopButton = new XNACS1Rectangle(new Vector2(hudBackground.CenterX, hudBackground.CenterY),
                                                    hudBackground.Width * buttonSize, hudBackground.Height);
            goStopButton.Texture = "goButton";
            goStopButton.Label = "GO";
            goStopButton.LabelColor = Color.White;

            // timer is second from right.
            timer = new XNACS1Rectangle(new Vector2(hudBackground.CenterX + (hudBackground.Width / 2) - 3 * (hudBackground.Width * buttonSize * .5f), hudBackground.CenterY),
                                                    hudBackground.Width * buttonSize, hudBackground.Height);
            timer.Label = "00:00";

            // zoom is right-most button.
            zoomButton = new XNACS1Rectangle(   new Vector2(hudBackground.CenterX + (hudBackground.Width / 2) - (hudBackground.Width * buttonSize * .5f), hudBackground.CenterY),
                                                hudBackground.Width * buttonSize, hudBackground.Height);
            //zoomButton.Texture = "zoomButton";
            zoomButton.Label = "Zoom-In";
            zoomButton.LabelColor = Color.White;

            // set all background colors to black.
            hudBackground.Color = componentsButton.Color = coinsRemaining.Color = goStopButton.Color = timer.Color = zoomButton.Color = Color.Black;

            // set all label colors to white.
            hudBackground.LabelColor = componentsButton.LabelColor = coinsRemaining.LabelColor = goStopButton.LabelColor = timer.LabelColor = zoomButton.LabelColor = Color.White;
            #endregion
        }
コード例 #13
0
ファイル: LevelEnd.cs プロジェクト: AntMartz/fat-cats-final
        public LevelEnd()
        {
            levelEnded = new XNACS1Rectangle(XNACS1Base.World.WorldDimension / 2, XNACS1Base.World.WorldDimension.X, XNACS1Base.World.WorldDimension.Y);
            levelEnded.Color = Color.Black;

            mainLabel = new XNACS1Rectangle();
            mainLabel.Color = Color.Black;
            mainLabel.LabelColor = Color.White;

            timeLabel = new XNACS1Rectangle();
            timeLabel.Label = "Time Elapsed:";
            timeLabel.Color = Color.Black;
            timeLabel.LabelColor = Color.White;

            coinLabel = new XNACS1Rectangle();
            coinLabel.Label = "Coins Saved:";
            coinLabel.Color = Color.Black;
            coinLabel.LabelColor = Color.White;

            componentLabel = new XNACS1Rectangle();
            componentLabel.Label = "Components Used:";
            componentLabel.Color = Color.Black;
            componentLabel.LabelColor = Color.White;

            scoreLabel = new XNACS1Rectangle();
            scoreLabel.Label = "TOTAL SCORE:";
            scoreLabel.Color = Color.Black;
            scoreLabel.LabelColor = Color.White;

            timeStars = new XNACS1Rectangle[5];
            timeStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            coinStars = new XNACS1Rectangle[5];
            coinStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            componentStars = new XNACS1Rectangle[5];
            componentStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            finalScoreStars = new XNACS1Rectangle[5];
            finalScoreStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            this.Hide();
        }
コード例 #14
0
 public void init(Character character)
 {
     this.color = character.getColor();
     XNACS1Rectangle charBox = character.getPosition();
     this.box = new XNACS1Rectangle(charBox.Center, charBox.Width, charBox.Height);
     this.box.Color = this.color;
     box.AddToAutoDrawSet();
 }
コード例 #15
0
        public SpreadFireWeapon(Hero hero)
            : base(hero)
        {
            angledBullets = new Queue<XNACS1Circle>();

            info = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 12, GameWorld.topEdge - 4), 4, 4);
            info.Color = Color.Blue;
        }
コード例 #16
0
 public Laser(Hero hero)
 {
     this.hero = hero;
     float height = GameWorld.topEdge - GameWorld.bottomEdge;
     float width  = 1.5f;
     float padding = 1f;
     laserbeam = new XNACS1Rectangle(new Vector2(width / 2 + padding, height / 2), width, height);
     laserbeam.Color = new Color(Color.LightSkyBlue, 100);
 }
コード例 #17
0
ファイル: menuButton.cs プロジェクト: AntMartz/fat-cats-final
        private XNACS1Rectangle nameBox; // a rectangle to display the name of this component on.

        #endregion Fields

        #region Constructors

        public menuButton(Vector2 buttonCenter, float width, float height)
            : base(buttonCenter, width, height)
        {
            nameBox = new XNACS1Rectangle(buttonCenter, 10f, 10f);
            nameBox.Color = Color.White;
            countBox = new XNACS1Rectangle(buttonCenter, 10f, 10f);
            countBox.Color = Color.White;

            this.hideSelf();
        }
コード例 #18
0
ファイル: Credits.cs プロジェクト: AntMartz/fat-cats-final
        public Credits()
        {
            background = new XNACS1Rectangle();
            background.Texture = "mainMenuBackground";

            names = new XNACS1Rectangle();
            names.Texture = "empty";
            names.Label = "Team FatCat\n\nDarren Korman\nTony Martinez\nGaret Anderson";
            names.LabelColor = Color.Black;
            this.Hide();
        }
コード例 #19
0
        public Background()
        {
            Vector2 center = new Vector2(width/2, height/2);
            this.world = new XNACS1Rectangle(center, width, height);

            this.world.Color = Color.Black;

            this.foreground = new Starfield(0.08f, 0.02f, 6f);
            this.background = new Starfield(0.04f, 0.01f, 2f);
            this.ship = new InfinityShip(0.04f);
        }
コード例 #20
0
        public Window(string label)
        {
            float width = XNACS1Base.World.WorldMax.X;
            float height = XNACS1Base.World.WorldMax.Y;
            Vector2 center = new Vector2(width/2, height/2);
            this.window = new XNACS1Rectangle(center, width/3, height/3);

            this.window.Color = new Color(Color.Gray, 50);
            this.window.LabelColor = Color.White;
            this.window.Label = label;
        }
コード例 #21
0
        public Screen(string label)
        {
            float width = XNACS1Base.World.WorldMax.X;
            float height = XNACS1Base.World.WorldMax.Y;
            Vector2 center = new Vector2(width/2, height/2);
            this.screen = new XNACS1Rectangle(center, width, height);

            this.screen.Texture = "StartScreen_Background";
            this.screen.LabelColor = Color.White;
            this.screen.Label = label;
        }
コード例 #22
0
        public DyePack(Hero hero, float minX, float maxX, Color color)
        {
            this.hero = hero;

            float padding = hero.getPosition().Width * 2;

            float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding);
            float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding);
            box = new XNACS1Rectangle(new Vector2(randomX, randomY), 0.865f * height, height);
            box.Color = color;
            box.Texture = getTexture(color);
        }
コード例 #23
0
        public Character(Vector2 position, float width, float height)
        {
            this.position = new XNACS1Rectangle(position, width, height);
            this.position.Color = Game.randomColor();
            this.nextPosition = new XNACS1Rectangle(position, width, height);
            this.nextPosition.Visible = false;

            // set object into motion;
            this.position.Velocity = new Vector2(0, 0);
            this.alive = true;
            this.pendingCollisions = new List<XNACS1Rectangle>();
        }
コード例 #24
0
ファイル: background.cs プロジェクト: AntMartz/fat-cats-final
        private float[] startRadius; // an array holding calculated radiuses of starting rings.

        #endregion Fields

        #region Constructors

        public Background()
        {
            background = new XNACS1Rectangle(XNACS1Base.World.WorldDimension / 2, XNACS1Base.World.WorldDimension.X, XNACS1Base.World.WorldDimension.Y);
            background.Color = Color.Black;

            // starfield
            stars = new XNACS1Circle[50];
            for (int count = 0; count < stars.Length; count++)
            {
                stars[count] = new XNACS1Circle(new Vector2(0, 0), XNACS1Base.RandomFloat(0.125f, 1f));
                stars[count].CenterX = XNACS1Base.RandomFloat(0.25f, XNACS1Base.World.WorldDimension.X - 0.25f);
                stars[count].CenterY = XNACS1Base.RandomFloat(0.25f, XNACS1Base.World.WorldDimension.Y - 0.25f);
                stars[count].Color = Color.White;
            }

            // calculate how many rings will be needed...
            int ringsNeeded = 1;
            float growthSize = 0.50f;

            while (growthSize < XNACS1Base.World.WorldMax.X * 1.5)
            {
                ringsNeeded++;
                growthSize *= RATE_OF_GROWTH;
            }

            ringsNeeded = ringsNeeded / 40 - 1;
            rings = new Ring[ringsNeeded - 1];
            startRadius = new float[ringsNeeded];

            // calculate the starting radiuses of rings
            startRadius[startRadius.Length-1] = XNACS1Base.World.WorldMax.X * 1.5f;
            for (int i = startRadius.Length - 2; i >= 0; i--)
            {
                startRadius[i] = startRadius[i + 1];

                // each 40 ticks is an additional ring.
                for (int tick = 0; tick < 40; tick++)
                {
                    startRadius[i] /= RATE_OF_GROWTH;
                }
            }
            MIN_RADIUS = startRadius[0];
            MAX_RADIUS = startRadius[startRadius.Length - 1];

            // now create rings and set their radiuses
            string[] ringTextures = { "ringBlue", "ringPink" };
            for (int i = 0; i < rings.Length; i++)
            {
                rings[i] = new Ring(startRadius[i], ringTextures[0], i);
                rings[i].Radius = startRadius[i];
            }
        }
コード例 #25
0
        public ScoreTracker(Hero hero)
        {
            this.hero = hero;
            startPoint = hero.getPosition().Center;
            factor = hero.getPosition().Width;
            accumulatedDistance = 0.0f;

            float height = GameWorld.panelSize - 1;
            float width = 20f;
            Vector2 position = new Vector2((GameWorld.rightEdge / 2) + width, GameWorld.topEdge + (GameWorld.panelSize / 2));
            scoreBox = new XNACS1Rectangle(position, width, height);
            scoreBox.Color = Color.Transparent;
            scoreBox.LabelColor = Color.White;
        }
        public void Shoot(XNACS1Rectangle hero)
        {
            shot s = new shot(hero.Center, false);
            s.bullet.ShouldTravel = true;
            s.bullet.Velocity = (XNACS1Base.GamePad.ThumbSticks.Right.X == 0 && XNACS1Base.GamePad.ThumbSticks.Right.Y == 0) ? new Vector2(hero.Texture == "pennyRight" ? 1 : -1, 0) : XNACS1Base.GamePad.ThumbSticks.Right;
            list.Add(s);
            XNACS1Base.PlayACue("spell");

            //shot s2 = new shot(hero.Center, false);
            //s2.bullet.ShouldTravel = true;
            //s2.bullet.Velocity = s.bullet.Velocity;
            //s2.bullet.VelocityY = 0.25f;
            //list.Add(s2);
        }
コード例 #27
0
        public XNACS1LibDrawHelper(GraphicsDevice graphicsDevice, ContentManager c, XNACS1Rectangle worldBound, FontManager fontManager, Vector2 deviceSize)
        {
            m_DrawSet    = new List <XNACS1Primitive>();
            m_TravelSet  = new List <XNACS1Primitive>();
            m_EmitterSet = new List <XNACS1ParticleEmitter>();

            m_GraphicsDevice = graphicsDevice;

            mSpriteBatch = new SpriteBatch(m_GraphicsDevice);

            //
            SetTransformationMatrices(worldBound, deviceSize);

            m_TexTable    = new TextureTable(c);
            m_FontManager = fontManager;
            fontManager.SetDrawHelper(this);

            int       CircleSize = 256;
            Texture2D Circle     = new Texture2D(graphicsDevice, CircleSize, CircleSize);

            Color[] CircleData = new Color[CircleSize * CircleSize];
            for (int x = 0; x < CircleSize; x++)
            {
                for (int y = 0; y < CircleSize; y++)
                {
                    if (Math.Sqrt(Math.Pow(x - CircleSize / 2, 2) + Math.Pow(y - CircleSize / 2, 2)) > CircleSize / 2)
                    {
                        int off = x + CircleSize * y;
                        CircleData[off]   = Color.Black;
                        CircleData[off].A = 0x00;
                    }
                    else
                    {
                        CircleData[x + CircleSize * y] = Color.White;
                    }
                }
            }
            Circle.SetData <Color>(CircleData);

            Texture2D Square = new Texture2D(graphicsDevice, 1, 1);

            Color[] SquareData = new Color[1];
            SquareData[0] = Color.White;
            Square.SetData <Color>(SquareData);

            m_TheCircle = Circle;
            m_TheSquare = Square;
        }
コード例 #28
0
ファイル: Fan.cs プロジェクト: AntMartz/fat-cats-final
        public Fan( Vector2 center, 
            float width = 20.0f,
            float height = 20.0f,
            float rotation = 0f,
            float static_friction = 0.1f,
            float bounciness = 0.6f)
            : base(center, width, height, rotation, static_friction, bounciness)
        {
            this.myType = ComponentType.fan;
            this.SetTextureSpriteSheet("fan", 1, 2, 0);
            this.UseSpriteSheet = true;
            this.SetTextureSpriteAnimationFrames(0, 0, 0, 1, 5, SpriteSheetAnimationMode.AnimateForward);
            this.UseSpriteSheetAnimation = true;

            this.areaOfEffect = new XNACS1Rectangle(this.Center, 50f, 40f, "fanArea");
        }
コード例 #29
0
        public void SetTransformationMatrices(XNACS1Rectangle worldBound, Vector2 deviceSize)
        {
            Vector2 wMin = worldBound.MinBound;
            Vector2 wMax = worldBound.MaxBound;

            Vector2 size = wMax - wMin;
            Matrix  toOrg, toDC;

            toOrg = Matrix.CreateTranslation(-wMin.X, -wMin.Y, 0.0f);
            toDC  = Matrix.CreateScale(deviceSize.X / size.X, deviceSize.Y / size.Y, 1.0f);
            mW2D  = toOrg * toDC;

            m_WorldMin   = wMin;
            m_WorldMax   = wMax;
            m_DeviceSize = deviceSize;
        }
コード例 #30
0
        public AddComponentMenu()
        {
            // reset ButtonTouchStates
            for (int i = 0; i < NUM_BUTTONS; i++)
            {
                buttonTouchState[i] = false;
            }

            float screenWidth = XNACS1Base.World.WorldDimension.X;
            float screenHeight = XNACS1Base.World.WorldDimension.Y;
            Vector2 screenCenter = XNACS1Base.World.WorldDimension / 2;

            this.background = new XNACS1Rectangle(screenCenter, screenWidth * 0.8f, screenHeight * 0.8f);
            this.background.Visible = false;
            this.background.Color = Color.Black;

            for (int button = 0; button < NUM_BUTTONS; button++)
            {
                // how many of each component should there be?
                componentCounts[button] = 1; // XNACS1Base.RandomInt(2, 5);

                // determine where the center of this button should be...
                float xOffset = 0;
                float yOffset = 0;

                int column = button % 3;
                xOffset = column * this.background.Width * 0.3f - this.background.Width * 0.3f;

                if (button < 3)
                {
                    yOffset = this.background.Height * 0.225f;
                }
                else
                {
                    yOffset = this.background.Height * -0.225f;
                }

                Vector2 buttonCenter = screenCenter + new Vector2(xOffset, yOffset);

                this.menuButtons[button] = new XNACS1Rectangle(buttonCenter, background.Width * 0.20f, background.Height * 0.35f);
                this.menuButtons[button].Texture = menuButtonTextures[button];
                this.menuButtons[button].Visible = false;
                this.menuButtons[button].Color = Color.White;
                this.menuButtons[button].LabelColor = Color.White;
                //this.menuButtons[button].Label = "Button #" + button;
            }
        }
コード例 #31
0
ファイル: Spawner.cs プロジェクト: AntMartz/fat-cats-final
        /*Constructor*/
        public Spawner(Vector2 center, float width = 15f, float height = 30f,
            float rotation = 0f, float static_friction = 0f,
            float bounciness = 0f, int spawns = 0, int frequency = 20, float rand_angle = 60f,
            bool shouldMove = false, float leftBound = 0.0f, float rightBound = 0.0f)
            : base(center, width, height, rotation, static_friction, bounciness)
        {
            num_spawns = spawns;
            this.spawn_freq = frequency;
            num_spawned = 0;
            num_active = 0;
            this.theta = MathHelper.Clamp(rand_angle, 0f, 90f);
            this.state = SpawnState.Idle;

            this.ticks_to_spawn = this.spawn_freq;

            /*Set up list*/
            this.coins = new LinkedList<Money>();

            this.SetTextureSpriteSheet("Spawner", 3, 1, 0);
            this.UseSpriteSheet = true;
            this.SetTextureSpriteAnimationFrames(0, 0, 0, 0, 40, SpriteSheetAnimationMode.AnimateForward);
            this.UseSpriteSheetAnimation = true;

            if (!shouldMove)
            {
                this.movingSpawner = false;
            }
            else
            {
                // set up moving spawner.  starts at right bound and moves left.
                this.movingSpawner = true;
                this.movingArt = new XNACS1Rectangle();
                this.movingArt.SetTextureSpriteSheet("spawnerHelicopter", 1, 3, 0);
                this.movingArt.UseSpriteSheet = true;
                this.movingArt.SetTextureSpriteAnimationFrames(0, 0, 0, 2, 7, SpriteSheetAnimationMode.AnimateForward);
                this.movingArt.UseSpriteSheetAnimation = true;
                this.movingArt.Width = 120f;
                this.movingArt.Height = 60f;
                this.TopOfAutoDrawSet();
                this.travelTicks = XNACS1Base.World.TicksInASecond * 10;
                this.unitsMovedPerTick = (rightBound - leftBound) / travelTicks;
                this.VelocityDirection = new Vector2(-1, 0);
                this.CenterX = rightBound;
                this.movingArt.Center = this.Center;

            }
        }
コード例 #32
0
        public Space(Hero hero, List<Enemy> enemies, float leftEdge)
            : base()
        {
            this.hero = hero;

            powerups = new List<PowerUp>();
            dyepacks = new List<DyePack>();
            debris = new List<Debris>();
            trail = new Trail(hero);

            float height = GameWorld.topEdge;
            float position = (width * 0.5f) + leftEdge;

            space = new XNACS1Rectangle(new Vector2(position, height/2), width, height);
            space.Visible = false;

            // add dyepacks to space region
            List<Color> colors = Game.randomColorSet(Game.colorCount);
            float rightEdge = space.CenterX + space.Width / 2;
            float region = (rightEdge - leftEdge) / dyepackCount;
            for (int i = 0; i < dyepackCount; i++)
            {
                float regionLeft = leftEdge + (i * region);
                float regionRight = regionLeft + region;
                dyepacks.Add(new DyePack(hero, regionLeft, regionRight, colors[i % Game.colorCount]));
            }

            region = (rightEdge - leftEdge) / powerupCount;
            for (int i = 0; i < powerupCount; i++)
            {
                float regionLeft = leftEdge + (i * region);
                float regionRight = regionLeft + region;
                powerups.Add(PowerUp.randomPowerUp(hero, regionLeft, regionRight));
            }

            // offset the region to pad the space before the next element
            // this makes the region slightly smaller than it actually should be otherwise
            int offset = 1;
            region = (rightEdge - leftEdge) / (debrisCount + offset);
            for (int i = 0; i < debrisCount; i++) {
                float regionLeft = leftEdge + (i * region);
                float regionRight = regionLeft + region;
                debris.Add(new Debris(hero, enemies, regionLeft, regionRight));
            }
        }
コード例 #33
0
        /// <summary>
        /// <b>Do not override this method!</b> This method is used by the XNACS1Lib to create
        /// and initialize the entire system.
        ///
        /// Override InitializeWorld() and perform all your intialization there!
        ///
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            bool fullScreen = false;

#if WINDOWS_PHONE
            // Phone
            m_GraphicsAccess.m_GraphicsManager.PreferredBackBufferWidth  = m_GraphicsAccess.GraphicsDevice.DisplayMode.Width;
            m_GraphicsAccess.m_GraphicsManager.PreferredBackBufferHeight = m_GraphicsAccess.GraphicsDevice.DisplayMode.Height;
            m_GraphicsAccess.m_GraphicsManager.SupportedOrientations     = DisplayOrientation.Portrait;
            m_GraphicsAccess.m_GraphicsManager.ApplyChanges();
            fullScreen = true;
#else
#if WINDOWS
            // Windows
            int w = (int)(m_GraphicsAccess.GraphicsDevice.DisplayMode.Width * kDefaultWidthCoverage);
            if (w < XNACS1_AppWindowWidth)
            {
                XNACS1_AppWindowWidth  = w;
                XNACS1_AppWindowHeight = (int)(XNACS1_AppWindowWidth / kHDTVAspecRatio);
            }
#else
            // XBOX
            fullScreen = true;
#endif
#endif

            m_WorldBound       = new XNACS1Rectangle(RequestedWorldMin, RequestedWorldWidth, RequestedWorldWidth);
            m_WorldBound.Color = Color.CornflowerBlue;

            m_GraphicsAccess.m_FontManager = new FontManager(m_GraphicsManager.GraphicsDevice, Content, XNACS1_AppWindowHeight);
            m_GraphicsAccess.CreateDrawHelper();

            // Call user's initialize method
            InitializeWorld();

            if (!mDeviceSizeSet)
            {
                XNACS1Base.SetAppWindowPixelDimension(fullScreen, XNACS1_AppWindowWidth, XNACS1_AppWindowHeight);
            }
        }