public Player_Select_Popup(Game_State manager, ContentManager content, Input_Handler[] inputs, Rectangle bounds, GraphicsDevice graphicsDevice) : base(content, bounds) { this.manager = manager; this.inputs = inputs; this.ClientBounds = bounds; soundMenuA = content.Load<SoundEffect>("Sounds/MenuA"); soundMenuC = content.Load<SoundEffect>("Sounds/MenuC"); soundMenuD = content.Load<SoundEffect>("Sounds/MenuD"); font = content.Load<SpriteFont>("Menu/menufont"); for (int i = 0; i < 4; i++) { // Hook up input listener inputs[i].OnKeyRelease += HandleInput; // Set positions playerMenuBounds[i] = new Rectangle(((i) * ClientBounds.Width / 4), 0, ClientBounds.Width / 4, ClientBounds.Height); // Initialize the meus menus[i] = new Player_Select_Menu(content, this, font, playerMenuBounds[i]); } populateColors(content, graphicsDevice); }
public PlayerStatDisplay(SpriteFont font, int player_index, BoxingPlayer player, Input_Handler input, Rectangle bounds, Texture2D background, Texture2D bar) { this.player = player; this.bounds = bounds; this.background = background; this.tBar = bar; this.health = player.MaxHealth; this.stamina = player.MaxStamina; this.input = input; this.isActive = input.isActive; title = "Player " + player_index; //===================Initialize positions==================== int margin = 1; // the whitespace around the entry // Dimensions of the strings int stringHeight = (int)font.MeasureString("S").Y; int stringWidth = (int)font.MeasureString("MMM").X; // Dimensions of the bars int textX = bounds.X + stringWidth / 2; int barHeight = (int)(1.5f * stringHeight / 3); int barX = bounds.X + (int)(1.25f * stringWidth + 2); // Portions? int vertical_Portion = bounds.Height / 14; int textWidth = bounds.Width / 3; barWidth = bounds.X + bounds.Width - barX - 4; Vector2 start = new Vector2(bounds.X, bounds.Y); // Set position of the Title vTitle = new Vector2(bounds.X + bounds.Width / 2 - font.MeasureString(title).X, bounds.Y); vHealth = new Vector2(textX + margin, start.Y + margin + (1 * (stringHeight) + (1 * 2 * margin))); vStamina = new Vector2(textX + margin, start.Y + margin + (2 * (stringHeight) + (2 * 2 * margin))); rHealth = new Rectangle(barX, (int)start.Y + margin + (1 * (stringHeight) + (1 * 2 * margin)), barWidth, stringHeight); rStamina = new Rectangle(barX, (int)start.Y + margin + (2 * (stringHeight) + (2 * 2 * margin)), barWidth, stringHeight); Debug.WriteLine("rHealth.Y = " + rHealth.Y); rHealth.Width = (int)(barWidth * (player.CurrentHealth / player.MaxHealth)); rStamina.Width = (int)(barWidth * (player.CurrentStamina / player.MaxStamina)); int squarewidth = bounds.Width / 8; // Set position of ability cooldown squares for (int i = 0; i < 4; i++) { rAbilities[i] = new Rectangle(((i + 1) * (bounds.X + bounds.Width) / 5) - squarewidth / 2, (int)start.Y + margin + (3 * (stringHeight) + (3 * 2 * margin)), squarewidth, squarewidth); //Debug.WriteLine("Player " + player_index + " square " + (i + 1) + " initialized"); Debug.WriteLine("Player " + player_index + " square. X = " + rAbilities[i].X + "square.Y = " + rAbilities[i].Y); } }
public PlayerStatDisplay(SpriteFont font, int player_index, BoxingPlayer player,Input_Handler input, Rectangle bounds, Texture2D background, Texture2D bar) { this.player = player; this.bounds = bounds; this.background = background; this.tBar = bar; this.health = player.MaxHealth; this.stamina = player.MaxStamina; this.input = input; this.isActive = input.isActive; title = "Player " + player_index; //===================Initialize positions==================== int margin = 1; // the whitespace around the entry // Dimensions of the strings int stringHeight = (int)font.MeasureString("S").Y; int stringWidth = (int)font.MeasureString("MMM").X; // Dimensions of the bars int textX = bounds.X + stringWidth / 2; int barHeight = (int)( 1.5f * stringHeight / 3); int barX = bounds.X + (int)(1.25f * stringWidth + 2); // Portions? int vertical_Portion = bounds.Height / 14; int textWidth = bounds.Width / 3; barWidth = bounds.X + bounds.Width - barX - 4; Vector2 start = new Vector2(bounds.X, bounds.Y); // Set position of the Title vTitle = new Vector2(bounds.X + bounds.Width / 2 - font.MeasureString(title).X, bounds.Y); vHealth = new Vector2(textX + margin, start.Y + margin + (1 * (stringHeight) + (1 * 2 * margin))); vStamina = new Vector2(textX + margin, start.Y + margin + (2 * (stringHeight) + (2 * 2 * margin))); rHealth = new Rectangle(barX, (int)start.Y + margin + (1 * (stringHeight) + (1 * 2 * margin)), barWidth, stringHeight); rStamina = new Rectangle(barX, (int)start.Y + margin + (2 * (stringHeight) + (2 * 2 * margin)), barWidth, stringHeight); Debug.WriteLine("rHealth.Y = " + rHealth.Y); rHealth.Width = (int)(barWidth * (player.CurrentHealth / player.MaxHealth)); rStamina.Width = (int)(barWidth * (player.CurrentStamina / player.MaxStamina)); int squarewidth = bounds.Width / 8; // Set position of ability cooldown squares for (int i = 0; i < 4; i++) { rAbilities[i] = new Rectangle(((i + 1) * (bounds.X + bounds.Width) / 5) - squarewidth/2, (int)start.Y + margin + (3 * (stringHeight) + (3 * 2 * margin)), squarewidth, squarewidth); //Debug.WriteLine("Player " + player_index + " square " + (i + 1) + " initialized"); Debug.WriteLine("Player " + player_index + " square. X = " + rAbilities[i].X + "square.Y = " + rAbilities[i].Y); } }
public BoxingPlayer(Boxing_Manager bm, int playerIndex, Vector2 startPosition, Dictionary <string, Animation> animations, Input_Handler input, Color color, Texture2D blank, Rectangle healthBar, Rectangle platform, Item[] items, Dictionary <string, SoundEffect> soundEffects) { this.BoxingManager = bm; this.items = items; // set the items. The items know the states to be called. // To test the accuracy of the collision rect this.blank = blank; this.playerIndex = playerIndex; this.animations = animations; this.input = input; this.color = color; this.soundEffects = soundEffects; this.startPosition = startPosition; this.platform = platform; this.startPlatform = platform; levellevel = platform.Y; this.rHealthBar = healthBar; healthBarMaxWidth = healthBar.Width; // Listen for input input.OnKeyDown += HandleKeyDown; input.OnKeyRelease += HandleKeyRelease; // //items[0] = true; //items[1] = true; //items[2] = true; //items[3] = true; /*combinations[0, 0] = KeyPressed.Defend; * combinations[0, 1] = KeyPressed.Up; * combinations[0, 2] = KeyPressed.Attack; * * combinations[1, 0] = KeyPressed.Defend; * combinations[1, 1] = KeyPressed.Up; * combinations[1, 2] = KeyPressed.Kick; * * combinations[2, 0] = KeyPressed.Defend; * combinations[2, 1] = KeyPressed.Down; * combinations[2, 2] = KeyPressed.Attack; * * combinations[3, 0] = KeyPressed.Defend; * combinations[3, 1] = KeyPressed.Down; * combinations[3, 2] = KeyPressed.Kick;*/ // Set players for first round. Reset(startPosition); }
public LoadOut_Manager(Game_State state, Rectangle ClientBounds, Input_Handler[] inputs, List<Item>[] items) { this.state_man = state; this.ClientBounds = ClientBounds; this.inputs = inputs; this.items = items; //this.equipment = state.equipment; }
// Constructer public State_Manager(ContentManager Content, Rectangle ClientBounds) { this.Content = Content; this.ClientBounds = ClientBounds; state = GameState.Menu; for (int i = 0; i < 4; i++) { inputs[i] = new Input_Handler(); } }
public Settings_Popup(Game_State manager, ContentManager content, Input_Handler[] inputs, Rectangle bounds) : base(content, bounds) { // Make a white boundary smaller than the bounds. menuBounds = new Rectangle(bounds.Width / 20, bounds.Height / 20, bounds.Width - (bounds.Width / 20) * 2, bounds.Height - (bounds.Height / 20) * 2); //Debug.WriteLine(menuBounds.X + " " + menuBounds.Y + " " + menuBounds.Width + " " + menuBounds.Height); SoundEffect menuSound = content.Load<SoundEffect>("Sounds/MenuC"); menu = new Settings_Menu(content.Load<SpriteFont>("Menu/menufont"), menuBounds, menuSound); this.manager = manager; manager.inputs[0].OnKeyRelease += HandleInput; }
public BoxingPlayer(float x, float y, string name, int playerindex, int width, int height, Input_Handler input) { this.width = width; this.height = height; this.input = input; this.isActive = input.isActive; this.playerindex = playerindex; this.sname = name; this.state = new StateMoving(); maxhealth = Tools.BASE_HEALTH; maxcooldown = Tools.BASE_COOLDOWN; maxmovement = Tools.BASE_MOVEMENT; maxstamina = Tools.BASE_STAMINA; position = new Vector3(x, y, Tools.JUMP_HEIGHT); hurtbox = new Rectangle((int)position.X, (int)position.Y, width, height); spriteEffect = SpriteEffects.None; }
public Game_State(Game game, Input_Handler[] inputs, Rectangle bounds) { this.game = game; this.inputs = inputs; this.bounds = bounds; }
public Boxing_Manager(ContentManager content, Rectangle ClientBounds, Input_Handler[] inputs, GraphicsDevice gd, Camera camera) { this.graphicsDevice = gd; this.camera = camera; //camera = new Camera(ClientBounds); this.bounds = new Rectangle(0, 0, ClientBounds.Width, ClientBounds.Height); this.inputs = inputs; background = content.Load<Texture2D>("Boxing/AB Background"); font = content.Load<SpriteFont>("Menu/menufont"); blank = content.Load<Texture2D>("White"); #region Add StateNames StateNames.Add(smoving); StateNames.Add(sstopped); StateNames.Add(sjump); StateNames.Add(sattack1); StateNames.Add(sattack3); StateNames.Add(scasting); StateNames.Add(shit); StateNames.Add(sdead); #endregion #region ItemNames ItemNames.Add(cane); #endregion state = boxingstate.idle; level = new Level(this, ClientBounds, blank, background); for (int i = 0; i < 4; i++) playerStartPositions[i] = new Vector2(bounds.X + bounds.Width / 5 * (i + 1), level.platforms[level.platforms.Length - 1].Y); //level.platforms[level.platforms.Length - 1].Y = (int)playerStartPositions[0].Y; NumRounds = 1; itemInstances = new List<ItemInstance>(); healthBarDimensions = new Rectangle(0, 0, ClientBounds.Width / 16, ClientBounds.Height / 80); LoadContent(content); }