public SwampBoss() : base(-1) { species = "Swamp/boss"; hitbox = new Hitbox(200, 200); hitbox.active = true; maxHealth = 2500; health = maxHealth; target = Game1.characterManager.getRandomLiveCharacter(); currentState = EnemyState.Attacking; currentAI = EnemyAI.SwampBoss; oldAI = EnemyAI.SwampBoss; if (!texturesLoaded) { for (int i = 1; i <= 20; i++) { TextureManager.Add(Enemy.BASETEX + "Swamp/boss back " + i); TextureManager.Add(Enemy.BASETEX + "Swamp/boss side " + i); TextureManager.Add(Enemy.BASETEX + "Swamp/boss front " + i); } TextureManager.Add(Enemy.BASETEX + "Swamp/boss center 1"); TextureManager.Add(Enemy.BASETEX + "Swamp/boss center 2"); TextureManager.Add(Enemy.BASETEX + "Swamp/boss center bleed"); texturesLoaded = true; } bleedingTexture = new AnimatedTexture(Enemy.BASETEX + "Swamp/boss center bleed"); pulsatingTexture = new AnimatedTexture(Enemy.BASETEX + species + " center", 2, 250); setTexture(pulsatingTexture); }
public Dynamite() : base(-1) { idleTexture = new AnimatedTexture(Enemy.BASETEX + "Cave/dynamite"); explodingTexture = new AnimatedTexture(Enemy.BASETEX + "Cave/explosion small", 3, 200); fuseTexture = new AnimatedTexture(Enemy.BASETEX + "Cave/fuse", 3, 50); explodingTexture.setOnFrameHitbox(1, new Hitbox(20, 20)); explodingTexture.setOnFrameHitbox(2, new Hitbox(30, 30)); explodingTexture.setOnFrameHitbox(3, new Hitbox(40, 40)); explodingTexture.onFinish = kill; hitbox = new Hitbox(35, 24); hitbox.active = true; maxHealth = 1; hitDamage = 20; currentAI = EnemyAI.NoMoveKnockback; setTexture(idleTexture); }
public void setOnFrameRangeHitbox(int startFrame, int endFrame, Hitbox hitbox) { if (startFrame < 1 || startFrame > framemax || endFrame < 1 || endFrame > framemax) { throw new ArgumentOutOfRangeException("frame", "Frames need to be between 1 and framemax"); } if (endFrame < startFrame) { throw new ArgumentOutOfRangeException("frame", "End frame cannot be less than start frame"); } for (int i = startFrame; i <= endFrame; i++) { if (hitbox == null) { onFrameHitboxes[i - 1] = new Hitbox(0, 0); } else { onFrameHitboxes[i - 1] = hitbox; } } }
public DynaBoss() : base(-1) { if (!texturesLoaded) { TextureManager.Add(Enemy.BASETEX + "Cave/cave boss attack 1"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss attack 2"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss attack 3"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss hurt"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss walk 1"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss walk 2"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss walk 3"); TextureManager.Add(Enemy.BASETEX + "Cave/cave boss walk 4"); TextureManager.Add(Enemy.BASETEX + "Cave/dynamite"); TextureManager.Add(Enemy.BASETEX + "Cave/explosion small 1"); TextureManager.Add(Enemy.BASETEX + "Cave/explosion small 2"); TextureManager.Add(Enemy.BASETEX + "Cave/explosion small 3"); TextureManager.Add(Enemy.BASETEX + "Cave/explosion big 1"); TextureManager.Add(Enemy.BASETEX + "Cave/explosion big 2"); TextureManager.Add(Enemy.BASETEX + "Cave/explosion big 3"); TextureManager.Add(Enemy.BASETEX + "Cave/fuse 1"); TextureManager.Add(Enemy.BASETEX + "Cave/fuse 2"); TextureManager.Add(Enemy.BASETEX + "Cave/fuse 3"); texturesLoaded = true; } scale = 2f; hitbox = new Hitbox(360, 125); hitbox.active = true; moveSpeed = 100f; maxHealth = 2500f; health = maxHealth; movingTexture = new AnimatedTexture(Enemy.BASETEX + "Cave/cave boss walk", 4, 100); stunnedTexture = new AnimatedTexture(Enemy.BASETEX + "Cave/cave boss walk 2"); setTexture(movingTexture); position.X = Game1.levelManager.position.X + Game1.levelManager.screenWidth * 2; currentAI = EnemyAI.DynamiteBoss; oldAI = EnemyAI.DynamiteBoss; }
public Enemy(int type) { if (type == -1) { return; } species = enemyTypes[type]; hitbox = new Hitbox((int)(enemyHitboxes[type].width * .8f), (int)(enemyHitboxes[type].height * .8f)); hitbox.active = true; setTexture(new AnimatedTexture(Enemy.BASETEX + species, 2, 150)); target = Game1.characterManager.getRandomLiveCharacter(); currentState = EnemyState.Attacking; switch (type) { case 0: { scale = .75f; maxHealth = 50; currentAI = EnemyAI.Flee; break; } case 1: { maxHealth = 100; currentState = EnemyState.AttackingAll; currentAI = EnemyAI.NoMove; break; } case 2: { maxHealth = 100; currentAI = EnemyAI.NoFlee; break; } case 3: { maxHealth = 200; hitDamage = 15; currentAI = EnemyAI.Neutral; moveSpeed = 30f; break; } case 4: { maxHealth = 300; currentAI = EnemyAI.NoFlee; break; } case 5: { maxHealth = 50; currentAI = EnemyAI.Flee; break; } case 6: { maxHealth = 150; scale = .6f; currentAI = EnemyAI.NoFlee; break; } case 7: { maxHealth = 500; currentAI = EnemyAI.SpawnWords; currentState = EnemyState.Walking; attackSpeed = .5f; break; } case 8: { currentAI = EnemyAI.Flee; break; } } hitbox.width = (int)(hitbox.width * scale); hitbox.height = (int)(hitbox.height * scale); maxHealth *= 1.5f; health = maxHealth; oldAI = currentAI; }
public Character(Hitbox hitbox) : base(hitbox) { }
public Entity(Hitbox hitbox) { alive = true; position = INITIAL_POSITION; this.hitbox = hitbox; }
public Entity() { alive = true; position = INITIAL_POSITION; hitbox = new Hitbox(new Vector2(0, 0), 0, 0); }
public void setOnFrameRangeHitbox(int startFrame, int endFrame, Hitbox hitbox) { if (startFrame < 1 || startFrame > framemax || endFrame < 1 || endFrame > framemax) throw new ArgumentOutOfRangeException("frame", "Frames need to be between 1 and framemax"); if (endFrame < startFrame) throw new ArgumentOutOfRangeException("frame", "End frame cannot be less than start frame"); for (int i = startFrame; i <= endFrame; i++) { if (hitbox == null) onFrameHitboxes[i - 1] = new Hitbox(0, 0); else onFrameHitboxes[i - 1] = hitbox; } }
public void setOnFrameHitbox(int frame, Hitbox hitbox) { if (frame < 1 || frame > framemax) throw new ArgumentOutOfRangeException("frame", "Frame needs to be between 1 and framemax"); if (hitbox == null) onFrameHitboxes[frame - 1] = new Hitbox(0, 0); else onFrameHitboxes[frame - 1] = hitbox; }
public SwampFlower() : base(-1) { scale = 0.75f; hitbox = new Hitbox(80, 80); maxHealth = 25; hitDamage = 10; currentAI = EnemyAI.NoMove; }
public float intersectPercent(Hitbox otherHitbox) { if (!active || !otherHitbox.active) return 0f; Rectangle rout; Rectangle.Intersect(ref rectangle, ref otherHitbox.rectangle, out rout); return (float)(rout.Width * rout.Height) / (Math.Min(rectangle.Width * rectangle.Height, otherHitbox.rectangle.Width * otherHitbox.rectangle.Height)); }
public bool intersects(Hitbox otherHitbox) { if (!active || !otherHitbox.active) return false; return rectangle.Intersects(otherHitbox.rectangle); }
public Enemy(int type) { if (type == -1) return; species = enemyTypes[type]; hitbox = new Hitbox((int)(enemyHitboxes[type].width * .8f), (int)(enemyHitboxes[type].height * .8f)); hitbox.active = true; setTexture(new AnimatedTexture(Enemy.BASETEX + species,2, 150)); target = Game1.characterManager.getRandomLiveCharacter(); currentState = EnemyState.Attacking; switch (type) { case 0: { scale = .75f; maxHealth = 50; currentAI = EnemyAI.Flee; break; } case 1: { maxHealth = 100; currentState = EnemyState.AttackingAll; currentAI = EnemyAI.NoMove; break; } case 2: { maxHealth = 100; currentAI = EnemyAI.NoFlee; break; } case 3: { maxHealth = 200; hitDamage = 15; currentAI = EnemyAI.Neutral; moveSpeed = 30f; break; } case 4: { maxHealth = 300; currentAI = EnemyAI.NoFlee; break; } case 5: { maxHealth = 50; currentAI = EnemyAI.Flee; break; } case 6: { maxHealth = 150; scale = .6f; currentAI = EnemyAI.NoFlee; break; } case 7: { maxHealth = 500; currentAI = EnemyAI.SpawnWords; currentState = EnemyState.Walking; attackSpeed = .5f; break; } case 8: { currentAI = EnemyAI.Flee; break; } } hitbox.width = (int)(hitbox.width * scale); hitbox.height = (int)(hitbox.height * scale); maxHealth *= 1.5f; health = maxHealth; oldAI = currentAI; }