Example #1
0
 static void Main()
 {
     using (var game = new MyGame())
         game.Run();
 }
Example #2
0
        public void Update(MyGame game, GameTime gameTime, PlayerAction action)
        {
            if ((action & PlayerAction.MoveRight) == PlayerAction.MoveRight)
            {
                var newLocations = AddTexturesToList(2, 4);
                animatedSprite.Animation = newLocations.ToArray();
                right = true;
                left = false;
            }
            else if ((action & PlayerAction.MoveLeft) == PlayerAction.MoveLeft)
            {
                var newLocations = AddTexturesToList(1, 4);
                animatedSprite.Animation = newLocations.ToArray();
                left = true;
                right = false;
            }
            else if (right)
            {
                right = false;
                var newLocations = AddTexturesToList(2, 1);
                animatedSprite.Animation = newLocations.ToArray();
            }
            else if (left)
            {
                left = false;
                var newLocations = AddTexturesToList(1, 1);
                animatedSprite.Animation = newLocations.ToArray();
            }

            if ((action & PlayerAction.Fire) == PlayerAction.Fire)
            {
                currentPower = (int)Powers.Fire;
                currentPowerImageScale = .7f;
                animatedSprite.Texture = textureFire;
                this.PlaySpellSoundEffect();
            }
            if ((action & PlayerAction.Earth) == PlayerAction.Earth)
            {
                currentPower = (int)Powers.Earth;
                currentPowerImageScale = .68f;
                animatedSprite.Texture = textureEarth;
                this.PlaySpellSoundEffect();
            }
            if ((action & PlayerAction.Air) == PlayerAction.Air)
            {
                currentPower = (int)Powers.Air;
                currentPowerImageScale = .7f;
                animatedSprite.Texture = textureAir;
                this.PlaySpellSoundEffect();
            }
            if ((action & PlayerAction.Water) == PlayerAction.Water)
            {
                currentPower = (int)Powers.Water;
                currentPowerImageScale = .58f;
                animatedSprite.Texture = textureWater;
                this.PlaySpellSoundEffect();
            }
            animatedSprite.Update(gameTime);
            PlayerSize.X = (int)PlayerLocation.X;
            PlayerSize.Y = (int)PlayerLocation.Y;
        }
Example #3
0
 public void Update(MyGame game, GameTime gameTime)
 {
     throw new NotImplementedException();
 }
Example #4
0
        public void LoadContent(MyGame myGame)
        {
            soundEffectJump = myGame.Content.Load<SoundEffect>("Sounds/238282__meroleroman7__robot-jump-2");
            soundEffectSpell = myGame.Content.Load<SoundEffect>("Sounds/168180__speedenza__whoosh-woow-mk3");
            textureBasic = myGame.Content.Load<Texture2D>("Powers/Basic/basic");
            textureFire = myGame.Content.Load<Texture2D>("Powers/Fire/fire");
            textureWater = myGame.Content.Load<Texture2D>("Powers/Water/water");
            textureEarth = myGame.Content.Load<Texture2D>("Powers/Earth/earth");
            textureAir = myGame.Content.Load<Texture2D>("Powers/Air/air");

            animatedSprite = new AnimatedSprite(textureBasic, 4, 4, new Vector2[] { new Vector2(0,0)});
            currentTexture = textureEarth;
            PlayerSize = new Rectangle(0, 0, currentTexture.Width / animatedSprite.Columns, currentTexture.Height / animatedSprite.Rows);
        }
Example #5
0
 public void UnloadContent(MyGame myGame)
 {
     throw new NotImplementedException();
 }
Example #6
0
        public void Draw(MyGame game, GameTime gameTime)
        {
            game.spriteBatch.Begin();
            game.spriteBatch.Draw(GameLevel.PowerTextures[0, 0], GameLevel.PowerLocations[0], null, Color.White, 0, Vector2.Zero, .7f, SpriteEffects.None, 0);//fire
            game.spriteBatch.Draw(GameLevel.PowerTextures[1, 0], GameLevel.PowerLocations[1], null, Color.White, 0, Vector2.Zero, .58f, SpriteEffects.None, 0);//water
            game.spriteBatch.Draw(GameLevel.PowerTextures[2, 0], GameLevel.PowerLocations[2], null, Color.White, 0, Vector2.Zero, .68f, SpriteEffects.None, 0);//earth
            game.spriteBatch.Draw(GameLevel.PowerTextures[3, 0], GameLevel.PowerLocations[3], null, Color.White, 0, Vector2.Zero, .7f, SpriteEffects.None, 0);//air
            if (currentPower != 4)
            {
                game.spriteBatch.Draw(GameLevel.PowerTextures[currentPower, 1], GameLevel.PowerLocations[currentPower], null, Color.White, 0, Vector2.Zero, currentPowerImageScale, SpriteEffects.None, 0);
            }

            game.spriteBatch.End();
            animatedSprite.Draw(game.spriteBatch, PlayerLocation);
            
        }