public ChaseAndFireEngine(Game game) { // Chase engine remembers reference to the game _gameOwnedBy = game; game.IsMouseVisible = true; SoundEffect[] _PlayerSounds = new SoundEffect[5]; spriteBatch = new SpriteBatch(game.GraphicsDevice); p = new PlayerWithWeapon(game, game.Content.Load <Texture2D>(@"Textures/wizard_strip3"), new Vector2(400, 400), 3); //fireball = new Projectile(game, game.Content.Load<Texture2D>(@"Textures/fireball_strip4"), // new Sprite(game, game.Content.Load<Texture2D>(@"Textures/explosion_strip8"),p.position,8) // ,p.position, 4); p.loadProjectile(new Projectile(game, game.Content.Load <Texture2D>(@"Textures/fireball_strip4"), new Sprite(game, game.Content.Load <Texture2D>(@"Textures/explosion_strip8"), p.position, 8) , p.position, 4)); chasers = new CircularChasingEnemy[Utility.NextRandom(2, 5)]; for (int i = 0; i < chasers.Count(); i++) { chasers[i] = new CircularChasingEnemy(game, game.Content.Load <Texture2D>(@"Textures/Dragon_strip3"), Vector2.Zero, 3); chasers[i].myVelocity = (float)Utility.NextRandom(2, 5); chasers[i].position = new Vector2(Utility.NextRandom(game.GraphicsDevice.Viewport.Width - chasers[i].spriteWidth), Utility.NextRandom(game.GraphicsDevice.Viewport.Height - chasers[i].spriteHeight)); } }
public void AddPlayer(PlayerWithWeapon p) { // Add the player and set its current Tile to be the home Tile and it's position to match the home Tile player = p; player.CurrentPlayerTile = _tileManager.ActiveLayer.Passable.Where(t => t.TileName == "home").FirstOrDefault(); if (player.CurrentPlayerTile != null) { _tileManager.CurrentTile = player.CurrentPlayerTile; player.TilePosition = new Vector2(player.CurrentPlayerTile.X, player.CurrentPlayerTile.Y); } p.Health = 100; p.Hbar = new Helpers.HealthBar(Game, p.PixelPosition + new Vector2(-10, -10)); p.Site.TilePosition = p.TilePosition; //Tile Finish = _player.CurrentPlayerTile = _tileManager.ActiveLayer.getPassableTileAt((int)_player.Tileposition.X, (int)_player.Tileposition.Y); //Tile Start = RandomPassableTile(); //_path = Path(Start, Finish); //showPathTiles(_path); }
private void setupPlayer() { // initially left facing for proper rotations towards the mouse List <TileRef> initialFrames = new List <TileRef>() { new TileRef(16, 2, 0), new TileRef(16, 3, 0), new TileRef(16, 4, 0), new TileRef(16, 5, 0), new TileRef(16, 6, 0), new TileRef(16, 7, 0), new TileRef(16, 8, 0), }; player = new PlayerWithWeapon(Game, cam, new Vector2(0, 0), new Vector2(tileMap.GetLength(1), tileMap.GetLength(0)), initialFrames, 64, 64, 1.0f); // Default stopped player.setFrameSet(DIRECTION.UP, new List <TileRef> { new TileRef(15, 0, 0), new TileRef(16, 0, 0), new TileRef(17, 0, 0), new TileRef(18, 0, 0), new TileRef(19, 0, 0), new TileRef(20, 0, 0), new TileRef(21, 0, 0) }); player.setFrameSet(DIRECTION.DOWN, new List <TileRef> { new TileRef(15, 1, 0), new TileRef(16, 1, 0), new TileRef(17, 1, 0), new TileRef(18, 1, 0), new TileRef(19, 1, 0), new TileRef(20, 1, 0), new TileRef(21, 1, 0), }); player.setFrameSet(DIRECTION.LEFT, new List <TileRef> { new TileRef(16, 2, 0), new TileRef(16, 3, 0), new TileRef(16, 4, 0), new TileRef(16, 5, 0), new TileRef(16, 6, 0), new TileRef(16, 7, 0), new TileRef(16, 8, 0), }); player.setFrameSet(DIRECTION.RIGHT, new List <TileRef> { new TileRef(15, 2, 0), new TileRef(15, 3, 0), new TileRef(15, 4, 0), new TileRef(15, 5, 0), new TileRef(15, 6, 0), new TileRef(15, 7, 0), new TileRef(15, 8, 0), }); Projectile p = new Projectile(Game, player.PixelPosition, new List <TileRef>() { new TileRef(3, 0, 0), new TileRef(4, 0, 0), new TileRef(5, 0, 0), new TileRef(6, 0, 0) }, new List <TileRef>() { new TileRef(0, 0, 0), new TileRef(1, 0, 0), new TileRef(2, 0, 0) }, player.FrameWidth, player.FrameHeight, 1f); player.CurrentPlayerTile = TileManager.CurrentTile; player.loadProjectile(p); }