Example #1
0
 public override void init()
 {
     input = new GetInput(PlayerIndex.One);
     attachEventListeners();
     currentScreen = CurrentScreen.PAUSE;
     pauseScreen = new Sprite(mManager.startScreen, new Rectangle(0, 0, pauseWidth, pauseHeight), new Vector2(pausePosX, pausePosY));
     pauseFont = mManager.segueUIMono;
     pauseOptions = new List<string>();
     loadTextFile();
 }
Example #2
0
        public override void init()
        {
            //Shader stuff
            mDevice = mManager.mGraphicsDevice;
            tempBinding = mDevice.GetRenderTargets();
            tempRenderTarget = new RenderTarget2D(mDevice, 1280, 720);

            blurShader = new BlurFocusShader(mDevice, tempRenderTarget, mManager.blur);
            //rippleShader = new RippleShader(mDevice, tempRenderTarget, mManager.ripple);
            //Shader stuff ends

            //Map stuff
            map = mManager.mGame.Content.Load<Map>("maps\\" + mManager.mLevelName);
            mapDisplayDevice = new XnaDisplayDevice(mManager.mGame.Content, mDevice);
            map.LoadTileSheets(mapDisplayDevice);
            viewport = new xTile.Dimensions.Rectangle(new Size(1280, 720));
            //Map stuff done

            scoreCounter = new ScoreCounter();
            camera = new Camera();
            runEffect = new ParticleEffect(mManager.particleEffect, ParticleEffect.ParticleType.Dust, BlendState.AlphaBlend, camera);
            explosion = new ParticleEffect(mManager.particleEffect, ParticleEffect.ParticleType.Explosion, BlendState.Additive, camera);
            input = new GetInput(PlayerIndex.One);
            player = new Hero(mManager.heroSprites);
            shotList = new List<Shot>();
            puncheeList = new List<Punchee>();
            scoreAreaList = new List<ScoreArea>();
            chargingSoundEffect = mManager.chargingSound.CreateInstance();
            chargingSoundEffect.Pitch = 0.2f;

            attachEventListener();

            for (int i = 0; i < map.Layers[0].LayerWidth; i++)
            {
                for (int j = 0; j < map.Layers[0].LayerHeight; j++)
                {
                    Layer collision = map.Layers[0];
                    Location tileLocation = new Location(i, j);
                    Tile tile = collision.Tiles[tileLocation];

                    if (tile.TileIndex == 90)
                    {
                        ParticleEffect trail = new ParticleEffect(mManager.particleEffect, ParticleEffect.ParticleType.Knockback, BlendState.AlphaBlend, camera);
                        Punchee punched = new Punchee(mManager.startScreen, trail);
                        FollowAI followAI = new FollowAI(punched, player);
                        punched.addAI(followAI);
                        punched.mPosition.X = 32 * i;
                        punched.mPosition.Y = 32 * j;
                        puncheeList.Add(punched);
                    }

                    if (tile.TileIndex == 77)
                    {
                        int posX = i * 32;
                        int posY = j * 32;

                        ScoreArea scoreArea = new ScoreArea(posX, posY);
                        scoreAreaList.Add(scoreArea);
                    }
                }
            }
        }
Example #3
0
        private void init()
        {
            isAlive = true;
            mSprite = new AnimatedSprite();
            input = new GetInput(PlayerIndex.One);
            attachEventListener();

            mSprite.setSourceRect(new Microsoft.Xna.Framework.Rectangle(CelX, CelY, CelWidth, CelHeight));

            mSprite.mCurrentCel = 0;
            mSprite.mNumberOfCels = mCels;
            mSprite.msUntilNextCel = 100;
            mSprite.msPerCel = 100;

            mSprite.setScale(new Vector2(1.5f));
            mSprite.setOrigin(new Vector2(mSprite.getSourceRect().Width / 2, mSprite.getSourceRect().Height / 2));
            mPosition = new Vector2(640 - (mSprite.getSourceRect().Width / 2), 360 - (mSprite.getSourceRect().Height / 2));
            mVelocity = new Vector2(0);
        }
Example #4
0
 public override void init()
 {
     input = new GetInput(PlayerIndex.One);
     attachEventListeners();
     currentScreen = CurrentMenuScreen.MAIN;
     menuScreen = new Sprite(mManager.startScreen, new Rectangle(0, 0, 1280, 720), new Vector2(0));
     menuFont = mManager.segueUIMono;
     menuOptions = new List<string>();
     loadTextFile();
 }