コード例 #1
0
        bool mHeroBoundCollision;      // If there is a image bound collision for the hero

        public GameState()
        {
            // Set up the flower ...
            mFlower = new TexturedPrimitive("Flower", new Vector2(50, 35), new Vector2(60, 60));

            // Planes
            mPlane    = new TexturedPrimitive[kNumPlanes];
            mPlane[0] = new TexturedPrimitive("PatrolEnemy", new Vector2(10, 15), new Vector2(5, 10));
            mPlane[1] = new TexturedPrimitive("PatrolEnemy", new Vector2(90, 15), new Vector2(5, 10));
            mPlane[2] = new TexturedPrimitive("PatrolEnemy", new Vector2(90, 55), new Vector2(5, 10));
            mPlane[3] = new TexturedPrimitive("PatrolEnemy", new Vector2(10, 55), new Vector2(5, 10));

            mHeroTarget         = new TexturedPrimitive("Target", new Vector2(0, 0), new Vector2(3, 3));
            mCurrentPrim        = mPlane[0];
            mHeroBoundCollision = false;
            mHeroPixelCollision = false;

            mHero = new SpritePrimitive("SimpleSpriteSheet", new Vector2(20, 30), new Vector2(10, 10),
                                        4,  // Number of rows
                                        2,  // Number of columns
                                        0); // Padding between images


            // Start Hero by walking left and AnotherHero by walking towards right
            mHero.SetSpriteAnimation(0, 0, 0, 3, 10); // Slowly
        }
コード例 #2
0
        public GameState()
        {
            // Set up the flower ...
            mFlower = new TexturedPrimitive("Flower", new Vector2(50, 35), new Vector2(350, 350));

            // planes
            mPlane    = new TexturedPrimitive[kNumPlanes];
            mPlane[0] = new TexturedPrimitive("PatrolEnemy", new Vector2(20, -80), new Vector2(20, 40));
            mPlane[1] = new TexturedPrimitive("PatrolEnemy", new Vector2(150, -100), new Vector2(20, 40));
            mPlane[2] = new TexturedPrimitive("PatrolEnemy", new Vector2(150, 120), new Vector2(20, 40));
            mPlane[3] = new TexturedPrimitive("PatrolEnemy", new Vector2(20, 170), new Vector2(20, 40));

            mHeroBoundCollision = false;
            mHeroPixelCollision = false;

            mHero = new SpritePrimitive("SimpleSpriteSheet", new Vector2(10, 0), new Vector2(10, 10),
                                        4,  // number of rows
                                        2,  // number of columns
                                        0); // padding between images


            // Start Hero by walking left and AnotherHero by walking towards right
            mHero.SetSpriteAnimation(0, 0, 0, 3, 10); // slowly

            mParticleSystem = new ParticleSystem();
        }
コード例 #3
0
        public GameState()
        {
            // Set up the flower ...
            mFlower         = new TexturedPrimitive("ColisoesT", new Vector2(50, 35), new Vector2(450, 450));
            chao            = new TexturedPrimitive("ChaoT", new Vector2(50, 35), new Vector2(450, 450));
            Redes           = new TexturedPrimitive("RedesT", new Vector2(50, 35), new Vector2(450, 450));
            EntradaEdificio = new TexturedPrimitive("Saidadefora", new Vector2(50, 35), new Vector2(450, 450));

            mBullet = new TexturedPrimitive("Bullet", new Vector2(50, 35), new Vector2(3, 3));

            // Planes
            mPlane    = new TexturedPrimitive[kNumPlanes];
            mPlane[0] = new TexturedPrimitive("PatrolEnemy", new Vector2(100, -80), new Vector2(20, 40));
            mPlane[1] = new TexturedPrimitive("PatrolEnemy", new Vector2(150, -100), new Vector2(20, 40));
            mPlane[2] = new TexturedPrimitive("PatrolEnemy", new Vector2(150, 120), new Vector2(20, 40));
            mPlane[3] = new TexturedPrimitive("PatrolEnemy", new Vector2(20, 170), new Vector2(20, 40));

            mHeroTarget         = new TexturedPrimitive("Target", new Vector2(0, 0), new Vector2(3, 3));
            mHeroBoundCollision = false;
            mHeroPixelCollision = false;


            mBulletCollision = false;

            mHero = new SpritePrimitive("SimpleSpriteSheet", new Vector2(10, 0), new Vector2(5, 5),
                                        4,  // Number of rows
                                        2,  // Number of columns
                                        0); // Padding between images


            // Start Hero by walking left and AnotherHero by walking towards right
            mHero.SetSpriteAnimation(0, 0, 0, 3, 10); // Slowly
        }
コード例 #4
0
        bool mHeroBoundCollision; // If there is a image bound collision for the

        public GameState()
        {
            // Set up the flower ...
            mFlower = new TexturedPrimitive("Flower", new Vector2(50, 35), new Vector2(350, 350));

            // Planes
            mPlane    = new TexturedPrimitive[kNumPlanes];
            mPlane[0] = new TexturedPrimitive("PatrolEnemy", new Vector2(20, -80), new Vector2(10, 20));
            mPlane[1] = new TexturedPrimitive("PatrolEnemy", new Vector2(150, -100), new Vector2(10, 20));
            mPlane[2] = new TexturedPrimitive("PatrolEnemy", new Vector2(150, 120), new Vector2(10, 20));
            mPlane[3] = new TexturedPrimitive("PatrolEnemy", new Vector2(20, 170), new Vector2(10, 20));

            mHeroBoundCollision = false;
            mHeroPixelCollision = false;

            mHero = new SpritePrimitive("SimpleSpriteSheet", new Vector2(10, 0), new Vector2(10, 10),
                                        4,  // Number of rows
                                        2,  // Number of columns
                                        0); // Padding between images


            // Start Hero by walking left and AnotherHero by walking towards right
            mHero.SetSpriteAnimation(0, 0, 0, 3, 10); // Slowly

            // Begin background audio
            AudioSupport.PlayBackgroundAudio("Mind_Meld", 0.4f);
        }
コード例 #5
0
        private void UserControlUpdate()
        {
            #region Selecting Hero
            if (InputWrapper.Buttons.A == ButtonState.Pressed)
            {
                mCurrent = mHero;
            }
            if (InputWrapper.Buttons.B == ButtonState.Pressed)
            {
                mCurrent = mAnotherHero;
            }
            mCurrent.Position += InputWrapper.ThumbSticks.Right;
            #endregion

            #region Specifying rotation
            if (InputWrapper.Buttons.X == ButtonState.Pressed)
            {
                mCurrent.RotateAngleInRadian += MathHelper.ToRadians(1);
            }
            if (InputWrapper.Buttons.Y == ButtonState.Pressed)
            {
                mCurrent.RotateAngleInRadian += MathHelper.ToRadians(-1);
            }
            #endregion

            #region Sprite Sheet Update
            if (InputWrapper.ThumbSticks.Left.X == 0)
            {
                mCurrent.SpriteEndColumn = 0;  // Stops the animation
            }
            else
            {
                float useX = InputWrapper.ThumbSticks.Left.X;
                mCurrent.SpriteEndColumn = 3;
                if (useX < 0)
                {
                    mCurrent.SpriteBeginRow = 1;
                    mCurrent.SpriteEndRow   = 1;
                    useX *= -1f;
                }
                else
                {
                    mCurrent.SpriteBeginRow = 0;
                    mCurrent.SpriteEndRow   = 0;
                }
                mCurrent.SpriteAnimationTicks = (int)((1f - useX) * kSpriteSpeedFactor);
            }
            #endregion
        }
コード例 #6
0
        public GameState()
        {
            mHero = new SpritePrimitive("SimpleSpriteSheet",
                                        new Vector2(20, 30), new Vector2(10, 10),
                                        4,  // number of rows
                                        2,  // number of columns
                                        0); // padding between images

            mAnotherHero = new SpritePrimitive("SimpleSpriteSheet",
                                               new Vector2(80, 30), new Vector2(10, 10),
                                               4,  // number of rows
                                               2,  // number of columns
                                               0); // padding between images

            // Start Hero by walking left and AnotherHero by walking towards right
            mHero.SetSpriteAnimation(0, 0, 0, 3, 10);       // slowly
            mAnotherHero.SetSpriteAnimation(1, 0, 1, 3, 5); // twice as fast

            mCurrent = mAnotherHero;
        }