Exemple #1
0
        protected override void LoadContent()
        {
            this.villian    = Content.Load <Texture2D>("TextureAtlases/BadGuy");
            this.warrior    = Content.Load <Texture2D>("TextureAtlases/GoodGuy");
            this.background = Content.Load <Texture2D>("TextureAtlases/amarati");

            this.warriorObj = new Warrior("Warrior", warrior, 20, 20);
            vallians[0]     = new Vallian("First", villian, 50, 50);
            vallians[1]     = new Vallian("Second", villian, 150, 50);
            vallians[2]     = new Vallian("Thirt", villian, 250, 50);

            warriorAnimation = new AnimatedSprite(warriorObj, (int)TextureAtlasConstants.SpellcastRow, (int)TextureAtlasConstants.SpellcastEndCol);
            vallianAnimation = new AnimatedSprite(vallians[0], (int)TextureAtlasConstants.SpellcastRow, (int)TextureAtlasConstants.SpellcastEndCol); // here is only one test vallian animation
            this.spriteBatch = new SpriteBatch(GraphicsDevice);
        }
Exemple #2
0
        // Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
        // <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            initVectorWarrior = KeyboardInput.HandleKey(initVectorWarrior);      //event handler

            timeSinceLastChange += (float)gameTime.ElapsedGameTime.TotalSeconds; //second

            if (timeSinceLastChange > 1f)
            {
                initVectorVallian   = Vallian.NewPos(initVectorVallian);
                timeSinceLastChange = 0f;
            }
            else
            {
                initVectorVallian = Vallian.Move(initVectorVallian);
            }
            warriorAnimation.Update();
            base.Update(gameTime);
        }