public Explosion(World world, SpriteBatch spriteBatch, Vector2 position)
     : base(world, spriteBatch, position)
 {
     World.playSound("explosion");
     this.explosionAnimation = new Animation(EXPLOSION_ANIM_FILENAME, "Explosion");
     this.animationPlayer = new AnimationPlayer(SpriteBatch, explosionAnimation);
     this.radius = INITIAL_EXPLOSION_RADIUS;
 }
        /// <summary>
        /// Constructor for Flint's Hat.
        /// </summary>
        /// <param name="parentScreen">The screen which this object is a part of.</param>
        /// <param name="spriteBatch">The sprite batch which handles drawing this object.</param>
        /// <param name="position">The initial position of this character.</param>
        public SpaceBoss(Screen gameScreen, World world, SpriteBatch spriteBatch, Vector2 position, Character owner)
            : base(world, spriteBatch, position)
        {
            mass = 1.0f;
            //Set the Hat's owner
            this.owner = owner;

            this.gameScreen = gameScreen;

            //Set up the Animation Map
            animationMap = new Dictionary<string, Animation>();

            //Set up the Hat's Animations
            SetUpAnimation();

            animationPlayer = new AnimationPlayer(spriteBatch, animationMap["Fall"]);

            currentState = "None";

            //Set the Hat's positon
            if (owner.Facing == SpriteEffects.FlipHorizontally)
            {
                Position = owner.Position + new Vector2(20, -29);
            }
            else
            {
                Position = owner.Position + new Vector2(-20, -30);
            }

            //Set the hat's velocity
            if (currentState.Contains("Fall"))
            {
                velocity = new Vector2(0, 0);
            }

            //Initializes the hat's hotspots.
            List<CollisionHotspot> hotspots = new List<CollisionHotspot>();
            hotspots.Add(new CollisionHotspot(this, new Vector2(-1, -10), HOTSPOT_TYPE.top));
            hotspots.Add(new CollisionHotspot(this, new Vector2(-7, 1), HOTSPOT_TYPE.left));
            hotspots.Add(new CollisionHotspot(this, new Vector2(5, 1), HOTSPOT_TYPE.right));
            hotspots.Add(new CollisionHotspot(this, new Vector2(-1, 12), HOTSPOT_TYPE.bottom));
            Hotspots = hotspots;

            this.world = world;
            world.AddWorldObject(this);
            //this.ParentScreen.Components.Add(this);
        }
Пример #3
0
        /// <summary>
        /// Constructor for Flint's Hat.
        /// </summary>
        /// <param name="parentScreen">The screen which this object is a part of.</param>
        /// <param name="spriteBatch">The sprite batch which handles drawing this object.</param>
        /// <param name="position">The initial position of this character.</param>
        public FlintHat(Screen gameScreen, World world, SpriteBatch spriteBatch, Vector2 position, Character owner)
            : base(world, spriteBatch, position)
        {
            mass = 1.0f;
            //Set the Hat's owner
            this.owner = owner;

            this.gameScreen = gameScreen;

            //Set up the Animation Map
            animationMap = new Dictionary<string, Animation>();

            //Set up the Hat's Animations
            SetUpAnimation();

            //Set the current Animation
            currentAnimation = animationMap["Fall"];

            animationPlayer = new AnimationPlayer(spriteBatch, animationMap["Fall"]);

            currentState = "None";

            //Set the Hat's positon
            position = owner.Position + new Vector2(60, 0);

            //Set the hat's velocity
            velocity = new Vector2(0, 0);

            //Initializes the hat's hotspots.
            List<CollisionHotspot> hotspots = new List<CollisionHotspot>();
            hotspots.Add(new CollisionHotspot(this, new Vector2(-1, -10), HOTSPOT_TYPE.top));
            hotspots.Add(new CollisionHotspot(this, new Vector2(-7, 1), HOTSPOT_TYPE.left));
            hotspots.Add(new CollisionHotspot(this, new Vector2(5, 1), HOTSPOT_TYPE.right));
            hotspots.Add(new CollisionHotspot(this, new Vector2(-1, 12), HOTSPOT_TYPE.bottom));
            Hotspots = hotspots;

            this.world = world;
            world.AddWorldObject(this);
            //this.ParentScreen.Components.Add(this);
        }