public void should_stop_spawning_randoms(Greendo grendo) { if (grendo.dead) { spawn = false; } }
public void collision_detection(Greendo greendo) { if (!greendo.dead) { foreach (Monster m in monsters) { m.collision_detection(greendo); } } }
override public void collision_detection(Greendo greendo) { int damage = 0; foreach (Spell s in spells) { damage += s.collision_detection(greendo.get_bounding_rectangle()); } greendo.health -= damage; }
public override void collision_detection(Greendo greendo) { int damage = 25; int offset = 30; Rectangle r = greendo.get_bounding_rectangle(); Rectangle stop = new Rectangle(r.X + offset, r.Y + offset, r.Width - offset, r.Height - offset); if (Helper.check_rectangles(base.get_bounding_rectangle(), stop)) { greendo.health -= damage; } }
public void animate(Graphics g, Greendo greendo) { for (int i = 0; i < monsters.Count; i++) { if (monsters[i].dead) { monsters.Remove(monsters[i]); } } foreach (Monster m in monsters) { m.animate(g, greendo); } }
public bool get_background(Greendo hero) { hero.set_x_y(current.check_unreachables(hero.get_bounding_rectangle(), hero.dir)); bool changed = false; Background b = current.check_for_background_change(hero.get_bounding_rectangle()); if (b != null) { if (current != b) { changed = true; } current = b; hero.set_x_y_from_center(b.get_spawn()); } return(changed); }
public Game() { greendo = new Greendo(200, 300); map = new Map(); monsters = new Monster_Manager(2, 1.5f); monsters.set_bck_rectangle(map.current.get_size()); monsters.add_monster_image("bahamut"); monsters.add_monster_image("barrissoffee"); monsters.add_monster_image("ifrit"); monsters.add_monster_image("leviathan"); monsters.add_monster_image("magicpot"); monsters.add_monster_image("odin"); monsters.add_monster_image("phoenix"); monsters.add_monster_image("ryuk"); monsters.add_monster_image("siren"); monsters.add_monster_image("zemus"); monsters.add_spell_image("..\\..\\vproekt_data\\monsters\\spell", 6, true); }
abstract public void collision_detection(Greendo greendo);
abstract public void animate(Graphics g, Greendo greendo);
override public void animate(Graphics g, Greendo greendo) { if (is_alive()) { if (greendo.dead) { moving = false; casting = false; } else { if (base.delay == base.delay_ref) { next_step(greendo.get_bounding_rectangle()); base.delay = 0; } ++base.delay; } int vertical = 0; int nextx = base.bounding_rectangle.X; int nexty = base.bounding_rectangle.Y; switch (dir) { case Direction.Down: vertical = 0; nexty += base.speed; break; case Direction.Left: vertical = 1; nextx -= base.speed; break; case Direction.Right: vertical = 2; nextx += base.speed; break; case Direction.Up: vertical = 3; nexty -= base.speed; break; } int w = base.bounding_rectangle.Width; int h = base.bounding_rectangle.Height; if (moving) { if (base.move_position > 3) { base.move_position = 0; } base.bounding_rectangle.X = nextx; base.bounding_rectangle.Y = nexty; g.DrawImage(base.monster, base.bounding_rectangle.X, base.bounding_rectangle.Y, new Rectangle(base.move_position * w, vertical * h, w, h), GraphicsUnit.Pixel); ++base.move_position; } else if (casting) { //nema cast animacija g.DrawImage(base.monster, base.bounding_rectangle.X, base.bounding_rectangle.Y, new Rectangle(base.move_position, vertical * h, w, h), GraphicsUnit.Pixel); spells[spell_index].should_cast = true; spells[spell_index].prepare_spell(dir, base.bounding_rectangle); } else { g.DrawImage(base.monster, base.bounding_rectangle.X, base.bounding_rectangle.Y, new Rectangle(base.move_position, vertical * h, w, h), GraphicsUnit.Pixel); } foreach (Spell s in spells) { s.cast(g); } } else { base.death_animation(g); } base.health_string(g, "r "); }
public override void animate(Graphics g, Greendo greendo) { if (is_alive()) { if (greendo.dead) { moving = false; atacking = false; } else { if (base.delay == base.delay_ref) { next_step(greendo.get_bounding_rectangle()); base.delay = 0; } ++base.delay; } int vertical = 0; int nextx = base.bounding_rectangle.X; int nexty = base.bounding_rectangle.Y; switch (dir) { case Direction.Down: vertical = 0; nexty += base.speed; break; case Direction.Left: vertical = 1; nextx -= base.speed; break; case Direction.Right: vertical = 2; nextx += base.speed; break; case Direction.Up: vertical = 3; nexty -= base.speed; break; } int w = base.bounding_rectangle.Width; int h = base.bounding_rectangle.Height; if (moving) { if (base.move_position > 3) { base.move_position = 0; } base.bounding_rectangle.X = nextx; base.bounding_rectangle.Y = nexty; g.DrawImage(base.monster, base.bounding_rectangle.X, base.bounding_rectangle.Y, new Rectangle(base.move_position * w, vertical * h, w, h), GraphicsUnit.Pixel); ++base.move_position; } else if (atacking) { //nema attack animacija g.DrawImage(base.monster, base.bounding_rectangle.X, base.bounding_rectangle.Y, new Rectangle(base.move_position, vertical * h, w, h), GraphicsUnit.Pixel); } else { g.DrawImage(base.monster, base.bounding_rectangle.X, base.bounding_rectangle.Y, new Rectangle(base.move_position, vertical * h, w, h), GraphicsUnit.Pixel); } } else { base.death_animation(g); } base.health_string(g, "m "); }