/// <summary> /// Adds an animated player to the game. /// </summary> /// <param name="playerIndex">The player index to check for input, used for both GamePad and Keyboard input</param> /// <param name="imageName">This should point to an XML sprite-sheet. TODO:Link to SpriteSheet example</param> /// <returns>An AnimatedPlayer4DirectionGameComponent</returns> public FourDirectionPlayerComponent AddFourDirectionPlayer(PlayerIndex playerIndex, String imageName) { FourDirectionPlayerComponent animatedAdventurePlayerGameComponent = new FourDirectionPlayerComponent(this, imageName, playerIndex); AddComponent(animatedAdventurePlayerGameComponent); return(animatedAdventurePlayerGameComponent); }
public ProjectileComponent AddProjectile(FourDirectionPlayerComponent component, string sheetName, float acceleration) { Vector2 direction = component.GetProjectileDirection(); ProjectileComponent projectile = new ProjectileComponent(this, component, sheetName, direction, acceleration); Components.Add(projectile); return(projectile); }
public override void Setup() { viewableArea = AddWalls(0,24, "brick"); AddWizard1(); display1 = AddPlayerScoreDisplay(PlayerIndex.One, "segoe"); display1.Position = ScreenHelper.TopLeftQuarter; wizard2 = AddFourDirectionPlayer(PlayerIndex.Two, "wizard"); wizard2.Category = "wizard2"; wizard2.DisplayPosition = ScreenHelper.CenterRightQuarter; wizard2.OverlayColor = Color.Orange; display2 = AddPlayerScoreDisplay(PlayerIndex.Two, "segoe"); display2.Position = ScreenHelper.TopRightQuarter; AddMonsters("blob", 2); AddMonsters("ghost", 2); AddMonsters("ogre", 2); AddTimedEvent(3, AddRandomMonster); AddRuby(); AddCollisionHandler("wizard", "ruby", WizardRubyCollision); AddBackgroundImage("tile", viewableArea); AddInputHandler(PlayerOneFireball, PlayerIndex.One, Keys.RightControl, Buttons.A); AddInputHandler(PlayerTwoFireball, PlayerIndex.Two, Keys.LeftControl, Buttons.A); AddCollisionHandler("magicball", "brick", FireballBrickCollision); AddCollisionHandler("magicball", "monster", FireballMonsterCollision); AddCollisionHandler("wizard", "monster", WizardMonsterCollision); }
public void AddWizard1() { wizard1 = AddFourDirectionPlayer(PlayerIndex.One, "wizard"); wizard1.DisplayPosition = ScreenHelper.CenterLeftQuarter; }
public ProjectileComponent AddProjectile(FourDirectionPlayerComponent component, string sheetName, float acceleration) { Vector2 direction = component.GetProjectileDirection(); ProjectileComponent projectile = new ProjectileComponent(this, component, sheetName, direction, acceleration); Components.Add(projectile); return projectile; }
/// <summary> /// Adds an animated player to the game. /// </summary> /// <param name="playerIndex">The player index to check for input, used for both GamePad and Keyboard input</param> /// <param name="imageName">This should point to an XML sprite-sheet. TODO:Link to SpriteSheet example</param> /// <param name="category">Use this to add a second player with different collision rules.</param> /// <returns></returns> public FourDirectionPlayerComponent AddFourDirectionPlayer(PlayerIndex playerIndex, String imageName, String category) { FourDirectionPlayerComponent animatedAdventurePlayerGameComponent = new FourDirectionPlayerComponent(this, imageName, playerIndex); animatedAdventurePlayerGameComponent.Category = category; AddComponent(animatedAdventurePlayerGameComponent); return animatedAdventurePlayerGameComponent; }