public Boss(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; int[] bossAnimationFramesMoving = { 0 }; Animation bossAnimationMoving = new Animation(PlayType.Loop, bossAnimationFramesMoving, 11.0f); int[] bossAnimationFramesExploded = { 4, 5, 6, 7 }; Animation bossAnimationExploded = new Animation(PlayType.Loop, bossAnimationFramesExploded, 3.0f); Dictionary <string, Animation> bossAnimations = new Dictionary <string, Animation>() { { "moving", bossAnimationMoving }, { "exploded", bossAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteBoss, bossAnimations, 2, 1); currAnimation = "moving"; shootCooldown = rateoffire; m_size = new Vector2(m_world.m_spriteBoss.Bounds.Width / 2, m_world.m_spriteBoss.Bounds.Height); }
public Volcano(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; shootCooldown = rateoffire; shootCooldown2 = rateoffire; shootCooldown3 = rateoffire; }
public Hatch(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; m_dropsPowerUp = dropsPowerUp; int[] HatchAnimationFrames = { 0, 1 }; Animation HatchAnimation = new Animation(PlayType.Loop, HatchAnimationFrames, 3.0f); int[] HatchAnimationFramesExploded = { 4, 5, 6, 7 }; Animation HatchAnimationExploded = new Animation(PlayType.Loop, HatchAnimationFramesExploded, 3.0f); Dictionary <string, Animation> HatchAnimations = new Dictionary <string, Animation>() { { "idle", HatchAnimation }, { "exploded", HatchAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteHatch, HatchAnimations, 4, 2); currAnimation = "idle"; }
public Garun(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; int[] garunAnimationFramesMoving = { 25, 26, 27, 28, 27, 26, 25 }; Animation garunAnimationMoving = new Animation(PlayType.Loop, garunAnimationFramesMoving, 10.0f); int[] garunAnimationFramesExploded = { 80, 81, 82, 83 }; Animation garunAnimationExploded = new Animation(PlayType.Once, garunAnimationFramesExploded, 5.0f); Dictionary <string, Animation> garunAnimations = new Dictionary <string, Animation>() { { "moving", garunAnimationMoving }, { "exploded", garunAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteEnemies, garunAnimations, 5, 18); currAnimation = "moving"; center = m_pos.Y; offset = 0; //The offset to add to your Y radius = 50; //Whatever you want your radius to be }
public Jumper(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; center = m_pos.Y; default_maxVel = maxVel; int[] JumperAnimationFrames = { 35, 36, 37 }; Animation JumperAnimation = new Animation(PlayType.Once, JumperAnimationFrames, 3.0f); int[] JumperAnimationFramesExploded = { 80, 81, 82, 83 }; Animation JumperAnimationExploded = new Animation(PlayType.Once, JumperAnimationFramesExploded, 5.0f); Dictionary <string, Animation> JumperAnimations = new Dictionary <string, Animation>() { { "moving", JumperAnimation }, { "exploded", JumperAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteEnemies, JumperAnimations, 5, 18); currAnimation = "moving"; }
public Player(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D ProjectileSprite, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, ProjectileSprite) { isDead = false; shootCooldown = rateoffire; continuousShootCooldown = continuousrateoffire; missileShootCooldown = 1500; m_depth -= 0.1f; activePowerUps = new List <PowerUpType>(); m_trail = new List <Vector2>(); for (int i = 0; i < TRAIL_SIZE; i++) { m_trail.Add(this.m_pos); } int[] playerAnimationFramesUp = { 0 }; Animation playerAnimationUp = new Animation(PlayType.Once, playerAnimationFramesUp, 3.0f); int[] playerAnimationFramesForward = { 1 }; Animation playerAnimationForward = new Animation(PlayType.Once, playerAnimationFramesForward, 3.0f); int[] playerAnimationFramesDown = { 2 }; Animation playerAnimationDown = new Animation(PlayType.Once, playerAnimationFramesDown, 3.0f); int[] playerAnimationFramesExploded = { 4, 5, 6, 7 }; Animation playerAnimationExploded = new Animation(PlayType.Once, playerAnimationFramesExploded, 3.0f); Dictionary <string, Animation> playerAnimations = new Dictionary <string, Animation>() { { "up", playerAnimationUp }, { "forward", playerAnimationForward }, { "down", playerAnimationDown }, { "exploded", playerAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteViper, playerAnimations, 4, 3); int[] shieldAnimationFrames = { 12, 13, 14, 15 }; Animation shieldAnimation = new Animation(PlayType.Once, shieldAnimationFrames, 3.0f); Dictionary <string, Animation> shieldAnimations = new Dictionary <string, Animation>() { { "up", shieldAnimation }, { "forward", shieldAnimation }, { "down", shieldAnimation }, { "exploded", shieldAnimation } }; m_shieldAnimator = new AnimationController(m_world.m_spriteProjectile, shieldAnimations, 8, 3); currAnimation = "forward"; }
public Ducker(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; m_dropsPowerUp = dropsPowerUp; int[] DuckerAnimationFramesWalking = { 45, 46 }; Animation DuckerAnimationWalking = new Animation(PlayType.Loop, DuckerAnimationFramesWalking, 16.0f); int[] DuckerAnimationFramesHolding = { 47 }; Animation DuckerAnimationHolding = new Animation(PlayType.Loop, DuckerAnimationFramesHolding, 3.0f); int[] DuckerAnimationFramesExploded = { 80, 81, 82, 83 }; Animation DuckerAnimationExploded = new Animation(PlayType.Loop, DuckerAnimationFramesExploded, 3.0f); Dictionary <string, Animation> DuckerAnimations = new Dictionary <string, Animation>() { { "walking", DuckerAnimationWalking }, { "shooting", DuckerAnimationHolding }, { "waiting", DuckerAnimationHolding }, { "exploded", DuckerAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteEnemies, DuckerAnimations, 5, 18); currAnimation = "walking"; }
public void spawnEnemy(Dictionary <string, FuncWorks.XNA.XTiled.Property> enemyProperties, Vector2 enemyPosition) { MovableType enemyType; Vector2 enemySize; float enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire; Texture2D enemySprite, enemyProjectileSprite; List <Enemy> enemySquad; bool enemyDropsPowerUp, enemyHasSquad; AnimationController enemyAnimator; int enemyQuantity = (int)enemyProperties["quantity"].AsInt32; enemyHasSquad = (bool)enemyProperties["hasSquad"].AsBoolean; enemyDropsPowerUp = (bool)enemyProperties["dropsPowerUp"].AsBoolean; enemyType = MovableType.Enemy; if (enemyHasSquad) { enemySquad = new List <Enemy>(); } else { enemySquad = null; } switch (enemyProperties["type"].Value) { case "Fan": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 200; enemyAccel = 800; enemyFriction = 800; enemyRateoffire = 0; enemyContinuousrateoffire = 0; for (int i = 1; i <= enemyQuantity; i++) { Fan newFan = new Fan(m_worldMap.m_world, enemyPosition + new Vector2(50 * i, 0), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newFan); if (enemyHasSquad) { newFan.addToSquad(); } } } break; case "Garun": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 80; enemyAccel = 800; enemyFriction = 800; enemyRateoffire = 0; enemyContinuousrateoffire = 0; for (int i = 1; i <= enemyQuantity; i++) { int y = 0; if (i % 2 == 0) { y = 50; } Garun newGarun = new Garun(m_worldMap.m_world, enemyPosition + new Vector2(50 * i, y), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newGarun); if (enemyHasSquad) { newGarun.addToSquad(); } } } break; case "Rugal": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 80; enemyAccel = 800; enemyFriction = 800; enemyRateoffire = 0; enemyContinuousrateoffire = 0; for (int i = 1; i <= enemyQuantity; i++) { int y = 0; if (i % 2 == 0) { y = 50; } Rugal newRugal = new Rugal(m_worldMap.m_world, enemyPosition + new Vector2(50 * i, y), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newRugal); if (enemyHasSquad) { newRugal.addToSquad(); } } } break; case "Dee-01": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 50; enemyAccel = 500; enemyFriction = 500; enemyRateoffire = 1.0f; enemyContinuousrateoffire = 1.0f; for (int i = 1; i <= enemyQuantity; i++) { Dee newdee = new Dee(m_worldMap.m_world, enemyPosition + new Vector2(50 * i, 0), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newdee); if (enemyHasSquad) { newdee.addToSquad(); } } } break; case "Ducker": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 50; enemyAccel = 500; enemyFriction = 500; enemyRateoffire = 1.0f; enemyContinuousrateoffire = 1.0f; for (int i = 1; i <= enemyQuantity; i++) { Ducker newDucker = new Ducker(m_worldMap.m_world, enemyPosition - new Vector2(m_worldMap.m_view.Width * i, 0), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newDucker); if (enemyHasSquad) { newDucker.addToSquad(); } } } break; case "Dagumu": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 50; enemyAccel = 500; enemyFriction = 500; enemyRateoffire = 1.0f; enemyContinuousrateoffire = 1.0f; for (int i = 1; i <= enemyQuantity; i++) { Hatch newHatch = new Hatch(m_worldMap.m_world, enemyPosition + new Vector2(50 * i, 0), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteHatch, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newHatch); if (enemyHasSquad) { newHatch.addToSquad(); } } } break; case "Rush": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 200; enemyAccel = 200; enemyFriction = 500; enemyRateoffire = 1.0f; enemyContinuousrateoffire = 1.0f; for (int i = 1; i <= enemyQuantity; i++) { Rush newRush = new Rush(m_worldMap.m_world, enemyPosition + new Vector2(0, i * 50), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newRush); if (enemyHasSquad) { newRush.addToSquad(); } } } break; case "Jumper": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteEnemies, null, 5, 18); enemyMaxVel = 150; enemyAccel = 150; enemyFriction = 500; enemyRateoffire = 1.0f; enemyContinuousrateoffire = 1.0f; for (int i = 1; i <= enemyQuantity; i++) { Jumper newJumper = new Jumper(m_worldMap.m_world, enemyPosition + new Vector2(i * 50, 0), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newJumper); if (enemyHasSquad) { newJumper.addToSquad(); } } } break; case "boss": { enemyAnimator = new AnimationController(m_worldMap.m_world.m_spriteBoss, null, 2, 1); enemyMaxVel = 100; enemyAccel = 500; enemyFriction = 500; enemyRateoffire = 1.0f; enemyContinuousrateoffire = 5.0f; for (int i = 1; i <= enemyQuantity; i++) { Boss newBoss = new Boss(m_worldMap.m_world, new Vector2(m_worldMap.screenWidth - enemyAnimator.m_spriteSheet.Width / 2, m_worldMap.m_screenMiddle.Y), new Vector2(enemyAnimator.m_currentSpriteRect.Width, enemyAnimator.m_currentSpriteRect.Height), enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newBoss); if (enemyHasSquad) { newBoss.addToSquad(); } } } break; case "volcano": { enemyAnimator = null; enemyMaxVel = 0; enemyAccel = 0; enemyFriction = 0; enemyRateoffire = 0.8f; enemyContinuousrateoffire = 0.8f; for (int i = 0; i < enemyQuantity; i++) { Volcano newVolcano = new Volcano(m_worldMap.m_world, enemyPosition + new Vector2(300 * i, 0), Vector2.Zero, enemyMaxVel, enemyAccel, enemyFriction, enemyRateoffire, enemyContinuousrateoffire, m_worldMap.m_world.m_spriteEnemies, enemyType, m_worldMap.m_world.m_spriteProjectile, enemySquad, m_worldMap, enemyDropsPowerUp, enemyAnimator); m_worldMap.m_world.m_entities.Add(newVolcano); if (enemyHasSquad) { newVolcano.addToSquad(); } } } break; } }
public Dee(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; m_dropsPowerUp = dropsPowerUp; int[] deeAnimationFrames = { 40 }; int[] deeAnimationFramesShoot = { 41 }; Animation deeAnimation = new Animation(PlayType.Loop, deeAnimationFrames, 3.0f); Animation deeAnimationShoot = new Animation(PlayType.Loop, deeAnimationFramesShoot, 3.0f); int[] deeAnimationFramesExploded = { 80, 81, 82, 83 }; Animation deeAnimationExploded = new Animation(PlayType.Loop, deeAnimationFramesExploded, 3.0f); Dictionary <string, Animation> deeAnimations = new Dictionary <string, Animation>() { { "idle", deeAnimation }, { "shooting", deeAnimationShoot }, { "exploded", deeAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteEnemies, deeAnimations, 5, 18); currAnimation = "idle"; }
public Fan(Game1 world, Vector2 pos, Vector2 size, float maxVel, float accel, float friction, float rateoffire, float continuousrateoffire, Texture2D sprite, MovableType type, Texture2D projectileSprite, List <Enemy> squad, WorldMap map, bool dropsPowerUp, AnimationController animator) : base(world, pos, size, maxVel, accel, friction, rateoffire, continuousrateoffire, sprite, type, projectileSprite, squad, dropsPowerUp) { worldmap = map; int[] fanAnimationFramesMoving = { 0, 1, 2, 3 }; Animation fanAnimationMoving = new Animation(PlayType.Loop, fanAnimationFramesMoving, 11.0f); int[] fanAnimationFramesExploded = { 80, 81, 82, 83 }; Animation fanAnimationExploded = new Animation(PlayType.Once, fanAnimationFramesExploded, 5.0f); Dictionary <string, Animation> fanAnimations = new Dictionary <string, Animation>() { { "moving", fanAnimationMoving }, { "exploded", fanAnimationExploded } }; m_animator = new AnimationController(m_world.m_spriteEnemies, fanAnimations, 5, 18); currAnimation = "moving"; }