public void Launch(Vector2 position, Vector2 velocity, bool aboveSnowMounds, Player owner) { PassedOverMound = false; Owner = owner; AboveSnowMounds = aboveSnowMounds; airTime = 0; Alive = true; Position = position; Velocity = velocity; Damage = 1; }
public Level(ContentManager content, Player player) { _content = content; _player = player; _player.Position = new Vector2(500, 500); _snowballs = new List<Snowball>(); _obstacles = new List<Obstacle>(); _enemies = new List<Enemy>(); Rand = new Random(); _oldKeyboardState = Keyboard.GetState(); _levelBackground = _content.Load<Texture2D>("LevelBackground"); _lifeCounterImage = _content.Load<Texture2D>("playerHat"); AddGameObjects(); }
internal void LaunchSnowball(Player thrower) { bool aCreateNew = true; foreach (Snowball snowball in _snowballs) { if (false)//snowball.Alive == false) { aCreateNew = false; snowball.Launch(new Vector2(thrower.Position.X + thrower.Width, thrower.Position.Y), thrower.GetThrowVelocity(), thrower.IsDucking(), thrower); thrower.ReleaseSnowball(); break; } } if (aCreateNew == true) { Snowball aSnowball = new Snowball(_content); aSnowball.Launch(new Vector2(thrower.Position.X + thrower.Width, thrower.Position.Y), thrower.GetThrowVelocity(), !thrower.IsDucking(), thrower); _snowballs.Add(aSnowball); } thrower.ReleaseSnowball(); }
/// <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 _gameState = new GameState(); _gameState = GameState.GamePlay; _player = new Player(Content); _currentLevel = new Level(Content, _player); base.Initialize(); }