public GameOverScreen(Player player, gameOverType gtt) { IsPopup = false; TransitionOnTime = TimeSpan.FromSeconds(0.2); TransitionOffTime = TimeSpan.FromSeconds(0.2); if (player != null)HighScores.sendScore(player.name, player.score); got = gtt; this.player = player; }
public HighScoreScreen(Player player) { IsPopup = false; TransitionOnTime = TimeSpan.FromSeconds(0.2); TransitionOffTime = TimeSpan.FromSeconds(0.2); highScores = HighScores.getScores(""); p = player; }
public LevelCompleteScreen(Player player, GameDifficulty gd, float acc) { this.player = player; IsPopup = false; TransitionOnTime = TimeSpan.FromSeconds(0.2); TransitionOffTime = TimeSpan.FromSeconds(0.2); this.score = player.score; this.lives = player._lives; this.gameDiff = gd; }
public override void LoadContent() { ContentManager content = ScreenManager.Game.Content; sound = content.Load<SoundEffect>("Sounds\\clicksound"); Texture2D norm = content.Load<Texture2D>("Buttons\\exitButtonGlow"); Texture2D glow = content.Load<Texture2D>("Buttons\\exitButton"); exitButton = new MenuButton(glow, norm, new Vector2(800 / 2 - (norm.Width / 2), 510), sound); instructions = content.Load<Texture2D>("instructions"); title = content.Load<Texture2D>("backgrounds\\instructions"); background = content.Load<Texture2D>("backgrounds\\title"); Texture2D playerTexture = content.Load<Texture2D>("manwalk"); mouse = new Mouse(content, "cursor"); player = new Player(playerTexture, mouse.texture, new Vector2(700, 500), content); }
public void Update(Player player, List<TileObject> objList ,TileLayer tLayer) { KeyboardState kbs = Keyboard.GetState(); isMovingLeft = false; isMovingRight = false; isMovingDown = false; isMovingUp = false; prevPosition = position; //BORDER TOP if (player._playerRec.Y <= (200 + player._playerRec.Height) && kbs.IsKeyDown(Keys.W) && !player.collision(new Vector2(0, -3), objList)) { position.Y -= 3; if (position.Y < 0) { position.Y = 0; } else { isMovingUp = true; } } else { isMovingUp = false; } //BOREDER BOTTOM if (player._playerRec.Y >= (screenHeight - 200 - player._playerRec.Height) && kbs.IsKeyDown(Keys.S) && !player.collision(new Vector2(0, 3), objList)) { position.Y += 3; if (position.Y > tLayer.MapHeight - screenHeight) { position.Y = tLayer.MapHeight - screenHeight; } else { isMovingDown = true; } } else { isMovingDown = false; } //BORDER RIGHT if (player._playerRec.X <= (200 + player._playerRec.Width) && kbs.IsKeyDown(Keys.A) && !player.collision(new Vector2(-3, 0), objList)) { position.X -= 3; if (position.X < 0) { position.X = 0; } else { isMovingLeft = true; } } else { isMovingLeft = false; } //BORDER LEFT if (player._playerRec.X >= (screenWidth - 200 - player._playerRec.Width) && kbs.IsKeyDown(Keys.D) && !player.collision(new Vector2(3, 0), objList)) { position.X += 3; if (position.X > tLayer.MapWidth - screenWidth) { position.X = tLayer.MapWidth - screenWidth; } else { isMovingRight = true; } } else { isMovingRight = false; } if (position == prevPosition) { isMovingLeft = false; isMovingDown = false; isMovingRight = false; isMovingUp = false; hasMoved = false; } else { hasMoved = true; } }
public override void LoadContent() { System.Threading.Thread.Sleep(10); levelstart = true; animList = new List<AnimatedSprite>(); if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); sound = content.Load<SoundEffect>("Sounds\\explode"); explosionTexture = content.Load<Texture2D>("sprites/explosion2"); playerTexture = content.Load<Texture2D>("manwalk"); mouseTexture = content.Load<Texture2D>("cursor"); playerSpawn = new Vector2(150,150); player = new Player(playerTexture, mouseTexture, playerSpawn, content); player.name = name; if (!isFirstLevel) { player.level = pLevel; player.score = pScore; player._health = pHealth; player._lives = pLives; } if (diff == GameDifficulty.HARD_MODE) player.MAX_SHOTS = 3; heart = content.Load<Texture2D>("1up"); isLevelComplete = false; enemyDeleteList = new List<Enemy>(); bulletDeleteList = new List<Bullet>(); eBulletDeleteList = new List<Bullet>(); cam = new Camera(new Vector2(0,0)); particleComponent = new ParticleComponent(ScreenManager.Game); ScreenManager.Game.Components.Add(particleComponent); if (player.level == 1) { objList = new List<TileObject>(); objList = TileHandler.getTileObjectLayout(content, "Content/Layers/LevelOneObjects.txt"); enemyList = new List<Enemy>(); if (diff == GameDifficulty.EASY_MODE ) enemyList = TileHandler.getEnemyLayout(content, "Content/Layers/LevelOneEnemyEasy.txt"); if (diff == GameDifficulty.HARD_MODE) enemyList = TileHandler.getEnemyLayout(content, "Content/Layers/LevelOneEnemyHard.txt"); spriteFont = content.Load<SpriteFont>("SpriteFont1"); backgroundLayer = TileLayer.FromFile(content, "Content/Layers/LevelOneBackgroundLayer.txt"); } if (player.level == 2) { objList = new List<TileObject>(); objList = TileHandler.getTileObjectLayout(content, "Content/Layers/LevelTwoObjects.txt"); enemyList = new List<Enemy>(); if (diff == GameDifficulty.EASY_MODE) enemyList = TileHandler.getEnemyLayout(content, "Content/Layers/LevelTwoEnemyEasy.txt"); if (diff == GameDifficulty.HARD_MODE) enemyList = TileHandler.getEnemyLayout(content, "Content/Layers/LevelTwoEnemyHard.txt"); spriteFont = content.Load<SpriteFont>("SpriteFont1"); backgroundLayer = TileLayer.FromFile(content, "Content/Layers/LevelOneBackgroundLayer.txt"); } if (player.level == 3) { objList = new List<TileObject>(); objList = TileHandler.getTileObjectLayout(content, "Content/Layers/LevelThreeObjects.txt"); enemyList = new List<Enemy>(); if (diff == GameDifficulty.EASY_MODE) enemyList = TileHandler.getEnemyLayout(content, "Content/Layers/LevelThreeEnemyEasy.txt"); if (diff == GameDifficulty.HARD_MODE) enemyList = TileHandler.getEnemyLayout(content, "Content/Layers/LevelThreeEnemyHard.txt"); spriteFont = content.Load<SpriteFont>("SpriteFont1"); backgroundLayer = TileLayer.FromFile(content, "Content/Layers/LevelTwoBackgroundLayer.txt"); Emitter testEmitter2 = new Emitter(); testEmitter2.Active = true; testEmitter2.TextureList.Add(content.Load<Texture2D>("raindrop")); testEmitter2.RandomEmissionInterval = new RandomMinMax(16.0d); testEmitter2.ParticleLifeTime = 1000; testEmitter2.ParticleDirection = new RandomMinMax(170); testEmitter2.ParticleSpeed = new RandomMinMax(10.0f); testEmitter2.ParticleRotation = new RandomMinMax(0); testEmitter2.RotationSpeed = new RandomMinMax(0f); testEmitter2.ParticleFader = new ParticleFader(false, true, 800); testEmitter2.ParticleScaler = new ParticleScaler(false, 1.0f); testEmitter2.Opacity = 255; particleComponent.particleEmitterList.Add(testEmitter2); } ScreenManager.AddScreen(new MessageBoxScreen("", mouseTexture), null); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteFont = Content.Load<SpriteFont>("SpriteFont1"); enemyDeleteList = new List<Enemy>(); bulletDeleteList = new List<Bullet>(); eBulletDeleteList = new List<Bullet>(); playerTexture = Content.Load<Texture2D>("manwalk"); mouseTexture = Content.Load<Texture2D>("cursor"); bulletTexture = Content.Load<Texture2D>("bullet2"); enemyTexture = Content.Load<Texture2D>("ZombieGreen"); //Texture2D enemyTexture2 = Content.Load<Texture2D>("ZombiePink"); Texture2D enemyTexture3 = Content.Load<Texture2D>("ZombieRed"); Texture2D enemyTexture4 = Content.Load<Texture2D>("ZombieOrange"); enemyList = new List<Enemy>(); int spawnMapWidth = spawnMap.GetLength(1); int spawnMapHeight = spawnMap.GetLength(0); for (int x = 0; x < spawnMapWidth; x++) { for (int y = 0; y < spawnMapHeight; y++) { int textIndex = spawnMap[y, x]; if (textIndex == -1) { continue; } Enemy e = new Enemy(enemyTexture, new Vector2(x * tileWidth, y * tileHeight), Enemy.enemyType.normal); enemyList.Add(e); } } //enemyList.Add(new Enemy(enemyTexture2, new Vector2(400, 400))); //enemyList.Add(new Enemy(enemyTexture3, new Vector2(500, 400))); enemyList.Add(new Enemy(enemyTexture4, new Vector2(600, 400),Enemy.enemyType.projectile, Content)); enemyList.Add(new Enemy(enemyTexture3, new Vector2(500, 400), Enemy.enemyType.boss, Content)); spriteBatch = new SpriteBatch(GraphicsDevice); // TILE STUFF tileDirt = Content.Load<Texture2D>("Tiles/se_free_dirt_texture"); tileGrass = Content.Load<Texture2D>("Tiles/se_free_grass_texture"); tileGround = Content.Load<Texture2D>("Tiles/se_free_ground_texture"); tileMud = Content.Load<Texture2D>("Tiles/se_free_mud_texture"); tileList.Add(tileDirt); tileList.Add(tileMud); tileList.Add(tileGround); tileList.Add(tileGrass); Texture2D tileHeart = Content.Load <Texture2D>("1up"); tileHand = Content.Load<Texture2D>("crate"); tileList2.Add(tileHand); tileList2.Add(tileHeart); player = new Player(playerTexture, mouseTexture, new Vector2(200, 200), new AnimatedSprite(playerTexture, 1, 2, 0.5f), Content); heart = Content.Load<Texture2D>("1up"); }
public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer, Player player) { screen.ControllingPlayer = controllingPlayer; screen.ScreenManager = this; screen.IsExiting = false; this.player = player; // If we have a graphics device, tell the screen to load content. if (isInitialized) { screen.LoadContent(); } screens.Add(screen); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteFont = Content.Load<SpriteFont>("SpriteFont1"); enemyDeleteList = new List<Enemy>(); bulletDeleteList = new List<Bullet>(); playerTexture = Content.Load<Texture2D>("manwalk"); mouseTexture = Content.Load<Texture2D>("cursor"); bulletTexture = Content.Load<Texture2D>("bullet2"); enemyTexture = Content.Load<Texture2D>("ZombieGreen"); enemyList = new List<Enemy>(); enemyList.Add(new Enemy(enemyTexture, new Vector2(500, 500))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(500, 10))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(200, 200))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(100, 500))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(200, 10))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(300, 200))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(400, 500))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(500, 10))); //enemyList.Add(new Enemy(enemyTexture, new Vector2(600, 200))); spriteBatch = new SpriteBatch(GraphicsDevice); // TILE STUFF tileDirt = Content.Load<Texture2D>("Tiles/se_free_dirt_texture"); tileGrass = Content.Load<Texture2D>("Tiles/se_free_grass_texture"); tileGround = Content.Load<Texture2D>("Tiles/se_free_ground_texture"); tileMud = Content.Load<Texture2D>("Tiles/se_free_mud_texture"); tileList.Add(tileDirt); tileList.Add(tileMud); tileList.Add(tileGround); tileList.Add(tileGrass); tileHand = Content.Load<Texture2D>("crate"); tileList2.Add(tileHand); player = new Player(playerTexture, mouseTexture, new Vector2(200, 200), bulletTexture, new AnimatedSprite(playerTexture, 1, 2, 0.5f)); }
/// <summary> /// Constructor automatically includes the standard "A=ok, B=cancel" /// usage text prompt. /// </summary> public welcomeScreen(string message, Player player) { this.message = message; this.player = player; }