public void Drop() { if (Carrier != null){ position = Carrier.position; Carrier.baseColor = Color.White; Carrier.flag = null; Carrier = null; } }
void BuildGameObjects() { scoringArea = new Rectangle(0, 0, 30, game.graphics.PreferredBackBufferHeight); flag = new Flag(game); float screenWidth = game.graphics.PreferredBackBufferWidth; float screenHeight = game.graphics.PreferredBackBufferHeight; //runner Vector2 startingPosition = new Vector2(screenWidth * 0.1f, screenHeight * 0.5f); IPlayerInput input = new KeyboardInput(); runner = new Runner(startingPosition, "Run", game, input); runner.DebugPosition = new Vector2(0.0f, screenHeight * 0.8f); characterList.Add(runner); // bomber A startingPosition = new Vector2(screenWidth * 0.35f, screenHeight * 0.15f); input = new GamePadInput(PlayerIndex.One); input.DebugPosition = new Vector2(game.graphics.PreferredBackBufferWidth * 0.25f, 0.0f); bomberA = new Bomber(startingPosition, "A", game, input); bomberA.DebugPosition = new Vector2(screenWidth * 0.25f, screenHeight * 0.8f); characterList.Add(bomberA); // bomber B startingPosition = new Vector2(screenWidth * 0.55f, screenHeight * 0.15f); input = new GamePadInput(PlayerIndex.Two); input.DebugPosition = new Vector2(game.graphics.PreferredBackBufferWidth * 0.50f, 0.0f); bomberB = new Bomber(startingPosition, "B", game, input); bomberB.DebugPosition = new Vector2(screenWidth * 0.50f, screenHeight * 0.8f); bomberB.velocity = Vector2.Zero; characterList.Add(bomberB); // bomber C startingPosition = new Vector2(screenWidth * 0.75f, screenHeight * 0.85f); input = new GamePadInput(PlayerIndex.Three); input.DebugPosition = new Vector2(game.graphics.PreferredBackBufferWidth * 0.75f, 0.0f); bomberC = new Bomber(startingPosition, "C", game, input); bomberC.DebugPosition = new Vector2(screenWidth * 0.75f, screenHeight * 0.8f); bomberC.velocity = Vector2.Zero; characterList.Add(bomberC); ChangeState(State.PreGame); }
public void PickUp(Runner runner) { Carrier = runner; runner.flag = this; }