public SnakeHead(GenerateObstacles obs, Map map, Bomberman player, GraphicsContext g, Vector2 scale) : base(obs, map, player, g, scale) { this.position.Width = 12 * scale.X; this.position.Height = 14 * scale.Y; this.health = 80; this.score = 100; this.sl = new SpriteLoader(); this.sl.cargarImagen(ANIMATION); this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scale.X), (int)(sl.getImage().Size.Height *scale.Y)))); this.ss = new SpriteSheet(this.sl.getImage()); up = new Animation[4]; down = new Animation[4]; left = new Animation[4]; right = new Animation[4]; for (int i = 0; i < 4; i++) { Sprite[] u = { ss.obtenerSprite((int)(0 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(1 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g) }; Sprite[] d = { ss.obtenerSprite((int)(6 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(7 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g) }; Sprite[] l = { ss.obtenerSprite((int)(8 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(9 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g) }; Sprite[] r = { ss.obtenerSprite((int)(2 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(3 * w * scale.X), (int)((2 * i + 1) * h * scale.Y + (i + 1) * scale.Y), (int)(w * scale.X), (int)(h * scale.X), g) }; up[i] = new Animation(u, 20, Animation.Direction.UP); down[i] = new Animation(d, 20, Animation.Direction.DOWN); left[i] = new Animation(l, 20, Animation.Direction.LEFT); right[i] = new Animation(r, 20, Animation.Direction.RIGHT); } Sprite[] die = { ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(1 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(2 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(3 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(4 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(5 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(6 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), ss.obtenerSprite((int)(7 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.X), g), new Score(score, w, h, g, scale).getImage() }; this.death = new Animation(die, 14, Animation.Direction.DOWN); animation = down[0]; animation.start(); }
public static void startLevel(int newLevel, int newMap) { level = newLevel; levelmap = newMap; continues = 2; initLevel(); player = new Bomberman(graphics, scales, map, cheats); font = new Font(new Vector4(255, 255, 255, 255), true, scales, graphics); if (newMap > 1) { setMenu(new MapMenu(newLevel, newMap, graphics, scales)); } else { setMenu(new LevelMenu(newLevel, graphics, scales)); } }
//private Animation animation; public Bomb(Bomberman player, GraphicsContext g, Vector2 scale) : base(scale) { //super(obs, map, player); this.position.X = 2 - (w * scale.X) / 2 + (int)Math.Round(((float)(player.position.X + (float)w * scale.X / 2) / (w * scale.X))) * (w * scale.X); this.position.Y = -(h * scale.Y) / 2 + (int)Math.Round(((float)(player.position.Y + (float)h * scale.Y / 2) / (h * scale.Y))) * (h * scale.Y); this.position.Width = 12 * scale.X; this.position.Height = 14 * scale.Y; explode = !player.hasRemoteDetonator(); this.potency = player.getPotency(); this.sl = new SpriteLoader(); this.sl.cargarImagen(ANIMATION); this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scale.X), (int)(sl.getImage().Size.Height *scale.Y)))); this.ss = new SpriteSheet(this.sl.getImage()); Sprite[] anim = { ss.obtenerSprite((int)(1 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(2 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(1 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(2 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(1 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(2 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g) }; // Animacion inicial animation = new Animation(anim, 10, Animation.Direction.DOWN); animation.start(); }
public DragonPurple(GenerateObstacles obs, Map map, Bomberman player, GraphicsContext g, Vector2 scale) : base(obs, map, player, g, scale) { this.position.Width = 12 * scale.X; this.position.Height = 14 * scale.Y; this.health = 10; this.score = 400; this.sl = new SpriteLoader(); this.sl.cargarImagen(ANIMATION); this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scale.X), (int)(sl.getImage().Size.Height *scale.Y)))); this.ss = new SpriteSheet(this.sl.getImage()); Sprite[] movDown = { ss.obtenerSprite((int)(9 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(10 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(11 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(10 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g) }; Sprite[] movUp = { ss.obtenerSprite((int)(3 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(4 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(5 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(4 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g) }; Sprite[] movLeft = { ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(1 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(2 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(0 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g) }; Sprite[] movRight = { ss.obtenerSprite((int)(6 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(7 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(8 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(7 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g) }; Sprite[] die = { ss.obtenerSprite((int)(12 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(13 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(14 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(15 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(16 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(17 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), ss.obtenerSprite((int)(18 * w * scale.X), 0, (int)(w * scale.X), (int)(h * scale.Y), g), new Score(score, w, h, g, scale).getImage() }; this.down = new Animation(movDown, 8, Animation.Direction.DOWN); this.up = new Animation(movUp, 8, Animation.Direction.UP); this.left = new Animation(movLeft, 8, Animation.Direction.LEFT); this.right = new Animation(movRight, 8, Animation.Direction.RIGHT); this.death = new Animation(die, 14, Animation.Direction.DOWN); // Animacion inicial animation = down; animation.start(); }
public Boss(GenerateObstacles obs, Map map, Bomberman player, GraphicsContext g, Vector2 scale) : base(obs, map, player, g, scale) { this.speed = (int)(1 * scale.X / 2); }
public static Enemy createEnemy(int type, GenerateObstacles obs, Map map, Bomberman player, GraphicsContext g, Vector2 scale) { switch (type) { case 0: return(new Balloon(obs, map, player, g, scale)); case 1: return(new BalloonPurple(obs, map, player, g, scale)); case 2: return(new BalloonBlue(obs, map, player, g, scale)); case 3: return(new BalloonRed(obs, map, player, g, scale)); case 4: return(new DragonPurple(obs, map, player, g, scale)); case 5: return(new GhostYellow(obs, map, player, g, scale)); // case 6: // return new SnakeHead(obs, map, player); case 7: return(new CrocodileGreen(obs, map, player, g, scale)); case 8: return(new GarlicBlue(obs, map, player, g, scale)); case 9: return(new FishGreen(obs, map, player, g, scale)); case 10: return(new GhostBlue(obs, map, player, g, scale)); case 11: return(new CoinYellow(obs, map, player, g, scale)); case 12: return(new GhostPink(obs, map, player, g, scale)); case 13: return(new Flame(obs, map, player, g, scale)); case 14: return(new DuckPurple(obs, map, player, g, scale)); case 15: return(new GhostWhite(obs, map, player, g, scale)); case 16: return(new Spinning(obs, map, player, g, scale)); case 17: return(new FrogYellow(obs, map, player, g, scale)); case 18: return(new GhostGreen(obs, map, player, g, scale)); } return(null); }