/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player = new Player(); playerMoveSpeed = 8.0f; base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { //Initialize the player class player = new Player(); base.Initialize(); }
public UnitPlayer(Player player) : base(player, 100) { _inventory = new NetworkObservableCollection<object>(); _headerX = _headerY = -1; _guns.CollectionChanged += _guns_CollectionChanged; }
private int spawnDelay = 10000; //in milliseconds #endregion Fields #region Constructors public GameForm(Player p, List<String> names) { InitializeComponent(); this.player = p; this.names = names; InitializeGame(); }
public override void intersectPlayer(Player p) { base.intersectPlayer(p); if (ImageY == 2) p.X += 1.5; else p.X -= 2; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player = new Player(0, 0); gameState = new GameStateManager("menu"); base.Initialize(); }
public EnemySpawn(LineBatch lineBatch, Level level, Player player) { this.lineBatch = lineBatch; this.level = level; this.player = player; this.random = new Random(); this.timer = new Timer(this.random.Next(SPIDER_MAX_DELAY)); spiders = new List<Spider>(); zombies = new List<Zombie>(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player = new Player(); playerMovementSpeed = 8.0f; TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new Backgrounds(); bgLayer2 = new Backgrounds(); base.Initialize(); }
public UnitHelper(Player player, int health) { _health = health; _player = player; _lastX = -1; _lastY = -1; _delay = 0; _guns = new NetworkObservableCollection<Gun>(); _dead = false; _selectedGun = 0; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // Initialize the player class player = new Player(); // Set a constant player move speed playerMoveSpeed = 8.0f; //Enable the FreeDrag gesture. TouchPanel.EnabledGestures = GestureType.FreeDrag; base.Initialize(); }
public void Update(Player player) { // The enemy always moves to the left so decrement x if (player.Position.X < Position.X) Position.X -= enemyMoveSpeed; else Position.X += enemyMoveSpeed; if (player.Position.Y < Position.Y) Position.Y -= enemyMoveSpeed; else Position.Y += enemyMoveSpeed; }
/// <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. _spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here // Load the player resources player = new Player(); Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(Content.Load<Texture2D>("Graphics\\player"), playerPosition); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(graphics.GraphicsDevice); lineBatch = new LineBatch(graphics.GraphicsDevice); arialFont = Content.Load<SpriteFont>("Arial"); level1 = new Level(lineBatch, "Level1"); currentLevel = level1; player = new Player(lineBatch, currentLevel, Player.PLAYER_START); enemySpawn = new EnemySpawn(lineBatch, currentLevel, player); }
public Enemy(GameWorld world, Player player, double x, double y, double direction, double power) : base(world, x, y, 12, 12) { this.player = player; timePassed = random.Next(1000); if (direction == -1) return; double speed = power * (random.Next(100) + 250); this.vX = speed * Math.Cos(direction); this.vY = speed * Math.Sin(-direction); }
public Transition(Shooter shooter, GameWorld oldWorld, GameWorld newWorld, int direction, Player player) : base(shooter) { this.oldWorld = oldWorld; this.newWorld = newWorld; this.player = player; switch (direction) { case RIGHT: vx = 1; break; case LEFT: vx = -1; break; case DOWN: vy = 1; break; case UP: vy = -1; break; } newWorld.Camera.x = 32 * 20 * -vx; newWorld.Camera.y = 24 * 20 * -vy; }
public void UpdateVariables(List<Enemy> enemies, List<HeavyEnemy> heavyEnemies, List<Diagonal> diagonals, List<HealthPowerUp> healthPowerUps, List<MissilePowerUp> missilePowerUps, List<RapidFirePowerUp> rapidFirePowerUps, List<Laser> projectiles, List<Animation> explosions, SpriteBatch spriteBatch, Player player, Texture2D mainBackground, ParallaxingBackground bgLayer1, ParallaxingBackground bgLayer2, List<Missile> missiles) { this.enemies = enemies; this.heavyEnemies = heavyEnemies; this.diagonals = diagonals; this.healthPowerUps = healthPowerUps; this.missilePowerUps = missilePowerUps; this.rapidFirePowerUps = rapidFirePowerUps; this.spriteBatch = spriteBatch; this.projectiles = projectiles; this.explosions = explosions; this.player = player; this.mainBackground = mainBackground; this.bgLayer1 = bgLayer1; this.bgLayer2 = bgLayer2; this.missiles = missiles; }
public void Update(Player player) { previousGamePadState = currentGamePadState; previousKeyboardState = currentKeyboardState; currentGamePadState = GamePad.GetState(PlayerIndex.One); currentKeyboardState = Keyboard.GetState(); if (currentGamePadState.Buttons.Back == ButtonState.Pressed || currentKeyboardState.IsKeyDown(Keys.Escape)) { quitRequested = true; return; } ///For now, the inputmanager can know about and directly update the player, considering the simplicity of this game. // Get Thumbstick Controls player.pos.X += currentGamePadState.ThumbSticks.Left.X * player.speed; player.pos.Y -= currentGamePadState.ThumbSticks.Left.Y * player.speed; // Use the Keyboard / Dpad if (currentKeyboardState.IsKeyDown(Keys.Left) || currentGamePadState.DPad.Left == ButtonState.Pressed) { player.pos.X -= player.speed; } if (currentKeyboardState.IsKeyDown(Keys.Right) || currentGamePadState.DPad.Right == ButtonState.Pressed) { player.pos.X += player.speed; } if (currentKeyboardState.IsKeyDown(Keys.Up) || currentGamePadState.DPad.Up == ButtonState.Pressed) { player.pos.Y -= player.speed; } if (currentKeyboardState.IsKeyDown(Keys.Down) || currentGamePadState.DPad.Down == ButtonState.Pressed) { player.pos.Y += player.speed; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player = new Player(); player2 = new Player(); playerMoveSpeed = 8.0f; s = new Servidor(); s.start(); // Initialize the enemies list enemies = new List<Enemy>(); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(1.0f); // Initialize our random number generator random = new Random(); TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); projectiles = new List<Projectile>(); projectiles2 = new List<Projectile>(); // Set the laser to fire every quarter second fireTime = TimeSpan.FromSeconds(.15f); explosions = new List<Animation>(); score = 0; score2 = 0; base.Initialize(); }
public override void LoadContent() { //////******************* INIT player = new Player(); // Set a constant player move speed playerMoveSpeed = 8.0f; //Enable the FreeDrag gesture. TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); // Initialize the enemies list enemies = new List<Enemy>(); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(1.0f); // Initialize our random number generator random = new Random(); projectiles = new List<Projectile>(); // Set the laser to fire every quarter second fireTime = TimeSpan.FromSeconds(.25f); explosions = new List<Animation>(); score = 0; //////////******************* LOAD if (Content == null) Content = new ContentManager(ScreenManager.Game.Services, "Content"); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = ScreenManager.SpriteBatch; //player.Initialize(Content.Load<Texture2D>("player"), playerPosition); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Vector2 playerPosition = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y + ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(playerAnimation, playerPosition); // Load the parallaxing background bgLayer1.Initialize(Content, "bgLayer1", ScreenManager.GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", ScreenManager.GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("mainbackground"); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); // Load the score font font = Content.Load<SpriteFont>("gameFont"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); SoundEffect.MasterVolume = (float)Game1.VolumeSound / 100; // Start the music right away PlayMusic(gameplayMusic); }
//============================================================================================================================ protected override void Initialize() { explosions = new List<Animation>(); diagonals = new List<Diagonal>(); state = gameState.startScreen; drawer = new Drawer(); collision = new Collision(); waveTimer = new WaveTimer(); //Initial values of variables score = 0; missileCount = 3; secondTimer = 60; difficultyFactor = 1.0f; transportShipHealth = 300; timePlayed = 0; projectiles = new List<Laser>(); missiles = new List<Missile>(); healthPowerUps = new List<HealthPowerUp>(); missilePowerUps = new List<MissilePowerUp>(); rapidFirePowerUps = new List<RapidFirePowerUp>(); transportHealTime = TimeSpan.FromSeconds(1.1); // Initialize the enemies list enemies = new List<Enemy>(); // Initialize the heavyEnemies list heavyEnemies = new List<HeavyEnemy>(); // Set the time keepers to zero waveTimer.previousEnemySpawnTime = TimeSpan.Zero; // Set the time keepers to zero previousHealthPowerUpSpawnTime = TimeSpan.Zero; previousMissilePowerUpSpawnTime = TimeSpan.Zero; previousRapidFirePowerUpSpawnTime = TimeSpan.Zero; //Used to determine how fast health power ups respawn healthPowerUpSpawnTime = TimeSpan.FromSeconds(12.5f); //Used to determine how fast health power ups respawn missilePowerUpSpawnTime = TimeSpan.FromSeconds(20.0f); //Used to determine how fast rapid fire power ups respawn rapidFirePowerUpSpawnTime = TimeSpan.FromSeconds(17.0f); // Initialize our random number generator random = new Random(); bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); // Initialize the player class player = new Player(); // Set a constant player move speed playerMoveSpeed = 12.0f; viewportHeight = GraphicsDevice.Viewport.Height; viewportWidth = GraphicsDevice.Viewport.Width; transportShip = new TransportShip(); transportShip.Initialize(viewportWidth,viewportHeight); playerCutscene = new PlayerCutscene(); playerCutscene.Initialize(viewportWidth, viewportHeight, GraphicsDevice.Viewport.TitleSafeArea.X, (GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2) - 34); base.Initialize(); }
private void UpdatePlayer(GameTime gameTime, Player tempPlayer, GamePadState tempPad) { player.Update(gameTime); // Get Thumbstick Controls tempPlayer.Position.X += tempPad.ThumbSticks.Left.X * playerMoveSpeed; tempPlayer.Position.Y -= tempPad.ThumbSticks.Left.Y * playerMoveSpeed; // Use the Keyboard / Dpad if (key.IsKeyDown(Keys.Left) || tempPad.DPad.Left == ButtonState.Pressed) { tempPlayer.Position.X -= playerMoveSpeed; } if (key.IsKeyDown(Keys.Right) || tempPad.DPad.Right == ButtonState.Pressed) { tempPlayer.Position.X += playerMoveSpeed; } if (key.IsKeyDown(Keys.Up) || tempPad.DPad.Up == ButtonState.Pressed) { tempPlayer.Position.Y -= playerMoveSpeed; } if (key.IsKeyDown(Keys.Down) || tempPad.DPad.Down == ButtonState.Pressed) { tempPlayer.Position.Y += playerMoveSpeed; } // Make sure that the player does not go out of bounds tempPlayer.Position.X = MathHelper.Clamp(tempPlayer.Position.X, 0, GraphicsDevice.Viewport.Width - tempPlayer.Width); tempPlayer.Position.Y = MathHelper.Clamp(tempPlayer.Position.Y, 0, GraphicsDevice.Viewport.Height - tempPlayer.Height); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { //Initialize the player class player = new Player(); // Set a constant player move speed playerMoveSpeed = 8.0f; //Enable the FreeDrag gesture. TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); // Initialize the enemies list enemies = new List<Enemy>(); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(1.0f); // Initialize our random number generator random = new Random(); //initialize the projectile objects projectiles = new List<Projectile>(); //set the laser ot fire every quarter second fireTime = TimeSpan.FromSeconds(.15f); //initialize explosion graphics explosions = new List<Animation>(); //set players score to 0 score = 0; base.Initialize(); }
protected override void Initialize() { //Initialize the player class player = new Player(); // Set a constant player move speed playerMoveSpeed = 5.0f; //Set player's score to zero score = 0; //Enable the FreeDrag gesture. TouchPanel.EnabledGestures = GestureType.FreeDrag; // Initialize the enemies list enemies = new List<Enemy>(); enemyTwo = new List<EnemyTwo>(); projectiles = new List<Projectile>(); explosions = new List<Animation>(); stars = new List<Star>(); particles = new List<Particle>(); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; previousTwoSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(ENEMY_SPAWN_TIME); enemyTwoSpawnTime = TimeSpan.FromSeconds(ENEMY_TWO_SPAWN_TIME); // Set the laser to fire every quarter second fireTime = TimeSpan.FromSeconds(FIRE_TIME); // Difficulty shift enemyOneShifter = new TimeSpan(0, 0, 0); enemyTwoShifter = new TimeSpan(0, 0, 0); GAME_OVER = false; // Initialize our random number generator random = new Random(); base.Initialize(); }
private void btnLocal_Click(object sender, EventArgs e) { player = GetPlayer(); AddPlayer(player.Name); LogUpdateText("Game Started !"); gf = new GameForm(player, names); gf.Player = player; gf.Show(); gf.isLocal = true; }
private Player GetPlayer() { String name = tbName.Text; player = new Player(0, name); return player; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // Initialize the player class player = new Player(); startScreenIsOn = true; endScreenIsOn = false; //gameState = false; // Set a constant player move speed playerMoveSpeed = 8.0f; //Enable the FreeDrag gesture. //TouchPanel.EnabledGestures = GestureType.FreeDrag; backgroundSpeed = -2; bgLayer1 = new ParallaxingBackground(); //bgLayer2 = new ParallaxingBackground(); // Initialize the enemies list enemies = new List<Enemy>(); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(2f); // Initialize our random number generator random = new Random(); projectiles = new List<Projectile>(); upgradeObjects = new List<UpgradeObject>(); // Set the laser to fire every quarter second fireTime = TimeSpan.FromSeconds(.15f); previousDropTime = TimeSpan.Zero; dropTime = TimeSpan.FromSeconds(4f); //dropTime = TimeSpan.FromSeconds(random.Next(0, 1)); explosions = new List<Animation>(); upgrades = new List<Animation>(); //Set player's score to zero score = 0; metScore = 200; level = 1; base.Initialize(); }
public Gun(Player player) { this.player = player; }
public static IScreen StartNewGame(bool story, int players, Map map) { OptionTextbox[] textboxes = new OptionTextbox[players]; for (int i = 0; i < players; i++) textboxes[i] = new OptionTextbox("Player " + (i + 1), 12); Menu m = new Menu(new Option("-"), new Option("Start Game", 0), new Option("Back", 1)); m.Options.InsertRange(0, textboxes); switch (m.Start(35, 7)) { case 0: for (int i = 0; i < players; i++) if (string.IsNullOrEmpty(textboxes[i].Text)) { m.Clear(); Menu msub = new Menu(Label.CreateLabelArrayFromText( "\nYou have to specify a name in\norder to start a new game.")); msub.Start(-1, 20); msub.Clear(); return StartNewGame(story, players, map); } Game g = new Game(); for (int i = 0; i < players; i++) { Player p = new Player(i); p.Name = textboxes[i].Text; g.Players[i] = p; } for (int i = players; i < 4; i++) g.Players[i] = null; if (story) g.LoadStoryMode(); else g.Map = map; g.CustomGame = !story; if (Game.Network != null) { Game.Network.Dispose(); Game.Network = null; } return new Shop(g); } m.Clear(); return null; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player = new Player(); playerMoveSpeed = 8.0f; TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); enemies = new List<Enemy>(); previousSpawnTime = TimeSpan.Zero; enemySpawnTime = TimeSpan.FromSeconds(1.0f); random = new Random(); projectiles = new List<Projectile>(); fireTime = TimeSpan.FromSeconds(.15f); explosions = new List<Animation>(); score = 0; base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here Player = new Player(); base.Initialize(); }