public Block(PungGame game) : base(game) { // Create a new block without knowledge of the safe zone so it can be will be placed anywhere randomly. position = new Vector2(Utilities.Randomizer.CreateRandom(0, Game.Window.ClientBounds.Width), Utilities.Randomizer.CreateRandom(0, Game.Window.ClientBounds.Height)); }
public Block(PungGame game, Rectangle spawnZone) : base(game) { // Start the block at a random position within the block spawning zone. position = new Vector2(Utilities.Randomizer.CreateRandom(spawnZone.X, spawnZone.Width), Utilities.Randomizer.CreateRandom(spawnZone.Y, spawnZone.Height)); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (PungGame game = new PungGame()) { game.Run(); } }
public GameObject(PungGame game) : base(game) { position = new Vector2(); spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch)); }
/// <summary> /// Add a block with a random block size to the game field and place it randomly /// </summary> /// <param name="game">Reference to the game.</param> public void addBlock(PungGame game) { // Create a new empty block, only his position is known at start. Block newBlock = new Block(game, blocksSafeZone); // Call the overloaded addBlock procedure to generate a texture and affect his objectRectangle addBlock(newBlock, Utilities.Randomizer.CreateRandom(MIN_BLOCK_SIZE, MAX_BLOCK_SIZE), Utilities.Randomizer.CreateRandom(MIN_BLOCK_SIZE, MAX_BLOCK_SIZE), new Color(255, 0, 0)); }
/// <summary> /// Create a new instance of the Player class. /// </summary> /// <param name="game"></param> /// <param name="playerNumber"></param> public Player(PungGame game, Pallet.PlayerNumber playerNumber) { pallet = new Pallet(game, playerNumber); }
/// <summary> /// Constructor used to instance a block at a particular position rather than a random one. /// </summary> /// <param name="game">Reference to the main Game class.</param> /// <param name="startingPosition">Position to spawn the block.</param> public Block(PungGame game, Vector2 startingPosition) : base(game) { position = startingPosition; }
public BlockManager(PungGame game) : base(game) { blocksList = new List<Block>(); }
/// <summary> /// Create a new instance of the Pallet class using the game reference and a player number. /// </summary> /// <param name="game">Reference to the game class.</param> /// <param name="playerNumber">Player number.</param> public Pallet(PungGame game, PlayerNumber playerNumber) : base(game) { playerIndex = playerNumber; // Associate the pallet to a player using it's player number. }