public RespecButton(Vector2 pos, SkillTree skTree, BaseState toAdd) : base(pos, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["ButtonStates"]), "Respec", true) { skillTree = skTree; toAdd.AddObjectToHandler("Respec Button", this); buttonText = " Respec"; zOrder = -5; }
public Arrow(Vector2 vel, Vector2 pos, string name, bool piercing = false) : base(vel, pos, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Arrow"]), name, 0) { acceleration.Y = 0.2f; id = count; count++; this.piercing = piercing; }
public FlappyBird() : base() { AddObjectToHandler("Frappy", new FrappyBird(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Frappy"]))); AddObjectToHandler("Pipe", new Pipe(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Pipe"]), new Vector2(850, -500))); AddObjectToHandler("Pipe", new Pipe(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Pipe"]), new Vector2(1200, -300))); AddObjectToHandler("Pipe", new Pipe(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Pipe"]), new Vector2(1550, -600))); AddObjectToHandler("Pipe", new Pipe(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Pipe"]), new Vector2(1900, -600))); }
public Cursor(Vector2 startPos, Texture2D cS) : base(startPos, "Cursor") { CheckForCollisions = true; startingPosition = new Vector2(600, 320); cursorSprite = cS; position = startPos; mouseClicked = true; onScreen = true; zOrder = 10; animationList = Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Cursor"]); }
/// <summary> /// The constructor for the button class, this takes the starting position, the player, and the Playskill that this object will activate /// </summary> /// <param name="startPos">Starting Position for the object</param> /// <param name="toSet">The Player to pass in</param> /// <param name="playerSkill">The skill that this button will activate</param> public SkillButton(Vector2 startPos, Player toSet, ActionSkills playerSkill) : base(startPos, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["SkillBox"]), "SkillButton", true) { position = startPos; skillToSet = playerSkill; myPlayer = toSet; parent = null; active = false; switch (skillToSet) { case ActionSkills.ChaoticReset: A_GoToFrameIndex(0); break; case ActionSkills.ConfuseRay: A_GoToFrameIndex(1); break; case ActionSkills.Exile: A_GoToFrameIndex(2); break; case ActionSkills.Ghost: A_GoToFrameIndex(3); break; case ActionSkills.LightJump: A_GoToFrameIndex(4); break; case ActionSkills.LightWall: A_GoToFrameIndex(5); break; case ActionSkills.ShadowDagger: A_GoToFrameIndex(6); break; case ActionSkills.ShadowHold: A_GoToFrameIndex(7); break; case ActionSkills.ShadowPush: A_GoToFrameIndex(8); break; default: A_GoToFrameIndex(0); break; } }
public TemporaryWall(int ToLive, Player myPlayer) : base(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["LightWallBlock"]), new Vector2(myPlayer.Position.X, myPlayer.Position.Y), "EdgeTile") { this.timeToLive = ToLive; if (myPlayer.HFlip == true) { position = new Vector2(myPlayer.Position.X - 50, myPlayer.Position.Y); hFlip = true; } else { position = new Vector2(myPlayer.Position.X + myPlayer.Width + 50, myPlayer.Position.Y); } Game1.OBJECT_HANDLER.AddObjectToHandler("LightWall", this); }
public Sword(Player playerToPass) : base(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Swords"]), playerToPass.Position, "Sword") { player = playerToPass; Game1.OBJECT_HANDLER.currentState.AddObjectToHandler("Sword", this); left = player.HFlip; if (left == false) { angle = -(float)Math.PI / 2; } else { angle = (float)Math.PI / 2; } UpdateCollisionBox(); }
/// <summary> /// Creates the level based on the information supplied. /// </summary> public void SetupLevel() { int edgeTiles = 0; int backgroundTiles = 0; for (int x = 0; x < LevelVariables.WIDTH; x++) { for (int y = 0; y < LevelVariables.HEIGHT; y++) { // Main Edge Tiles if (myMap.Terrain[x][y] == 'E') { AddObjectToHandler("EdgeTile", new EdgeTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), mainEdge, myMap.Terrain, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[mainTexture])), edgeTiles); edgeTiles++; } // Secondary Edge Tiles if (myMap.Terrain[x][y] == 'M') { AddObjectToHandler("EdgeTile", new EdgeTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), secondaryEdge, myMap.Terrain, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[secondaryTexture])), edgeTiles); edgeTiles++; } if (renderBackground) { // Main Background Tiles if (myMap.Terrain[x][y] == 'O') { AddObjectToHandler("BackgroundTile", new BackgroundTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[mainTexture])), backgroundTiles); backgroundTiles++; } // Secondary Background Tiles if (myMap.Terrain[x][y] == 'C') { AddObjectToHandler("BackgroundTile", new BackgroundTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[secondaryTexture])), backgroundTiles); backgroundTiles++; } } } } }
public StartButton() : base(new Vector2(50, 50), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["ButtonStates"]), " Start", true) { position = new Vector2(640, 360); buttonText = " Start!"; }
public HighScores() : base(new Vector2(50, 50), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["ButtonStates"]), " Scores", true) { position = new Vector2(500, 500); buttonText = " Scores!"; }
public StartFromLeaderboard(List <int> scores) : base(new Vector2(1000, 600), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["ButtonStates"]), " Start", true) { buttonText = " Start!"; scoreList = scores; }
/// <summary> /// The same as the defaul constructor except that it now takes a level to automaticaly add this object to the game. /// </summary> /// <param name="startPos">Starting position</param> /// <param name="toSet">the player to pass</param> /// <param name="playerSkill">The player skill to set</param> /// <param name="level">the level to add this object too</param> public SkillButton(Vector2 startPos, Player toSet, ActionSkills playerSkill, BaseState level) : base(startPos, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["SkillBox"]), "SkillButton", true) { position = startPos; skillToSet = playerSkill; myPlayer = toSet; parent = null; active = false; switch (skillToSet) { case ActionSkills.ChaoticReset: A_GoToFrameIndex(0); break; case ActionSkills.ConfuseRay: A_GoToFrameIndex(1); break; case ActionSkills.Exile: A_GoToFrameIndex(2); break; case ActionSkills.Ghost: A_GoToFrameIndex(3); break; case ActionSkills.LightJump: A_GoToFrameIndex(4); break; case ActionSkills.LightWall: A_GoToFrameIndex(5); break; case ActionSkills.ShadowDagger: A_GoToFrameIndex(6); break; case ActionSkills.ShadowHold: A_GoToFrameIndex(7); break; case ActionSkills.ShadowPush: A_GoToFrameIndex(8); break; case ActionSkills.Dash: A_GoToFrameIndex(9); break; case ActionSkills.AirMelee: A_GoToFrameIndex(10); break; case ActionSkills.AirRanged: A_GoToFrameIndex(11); break; case ActionSkills.FastFall: A_GoToFrameIndex(12); break; case ActionSkills.JumpHeight: A_GoToFrameIndex(13); break; case ActionSkills.JumpPlus: A_GoToFrameIndex(14); break; case ActionSkills.JumpTriple: A_GoToFrameIndex(14); break; case ActionSkills.Speed: A_GoToFrameIndex(15); break; case ActionSkills.Wings: A_GoToFrameIndex(16); break; default: A_GoToFrameIndex(0); break; } zOrder = -5; level.AddObjectToHandler("SkillButton", this); ShowActive(); }
/// <summary> /// Creates the level based on the information supplied. /// </summary> public void SetupLevel() { if (myPlayer == null) { myPlayer = new Player(new Vector2(200, (LevelVariables.HEIGHT - LevelVariables.GROUND_HEIGHT - 3) * 64), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["WalkRight"], Game1.ANIMATION_DICTIONARY["WalkLeft"])); } // Create the player AddObjectToHandler("Player", myPlayer); // Create the cursor AddObjectToHandler("Cursor", new Cursor(new Vector2(200, (LevelVariables.HEIGHT - LevelVariables.GROUND_HEIGHT - 3) * 64), Game1.IMAGE_DICTIONARY["cursor"])); //AddObjectToHandler("Button", new Button(new Vector2(200, 200), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["ButtonStates"]), "clickable test", true)); //AddObjectToHandler("NoButton", new Button(new Vector2(200, 300), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["ButtonStates"]), "unclickable test", true)); mySpawner = new Spawner(myMap.Terrain, -1); int edgeTiles = 0; int backgroundTiles = 0; for (int x = 0; x < LevelVariables.WIDTH; x++) { for (int y = 0; y < LevelVariables.HEIGHT; y++) { // Main Edge Tiles if (myMap.Terrain[x][y] == 'E') { AddObjectToHandler("EdgeTile", new EdgeTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), mainEdge, myMap.Terrain, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[mainTexture])), edgeTiles); edgeTiles++; } // Secondary Edge Tiles if (myMap.Terrain[x][y] == 'M') { AddObjectToHandler("EdgeTile", new EdgeTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), secondaryEdge, myMap.Terrain, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[secondaryTexture])), edgeTiles); edgeTiles++; } if (renderBackground) { // Main Background Tiles if (myMap.Terrain[x][y] == 'O') { AddObjectToHandler("BackgroundTile", new BackgroundTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[mainTexture])), backgroundTiles); backgroundTiles++; } // Secondary Background Tiles if (myMap.Terrain[x][y] == 'C') { AddObjectToHandler("BackgroundTile", new BackgroundTile(new Vector2(x * 64, (LevelVariables.HEIGHT - y) * 64), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[secondaryTexture])), backgroundTiles); backgroundTiles++; } } } } // Look at every enemy foreach (TemporaryEnemy myEnemy in mySpawner.EnemyData) { string enemyType = ""; // Figure out which enemy type to use, searching by movement type and size. switch (myEnemy.movementType) { case EnemyType.Flying: if (myEnemy.size == EnemySize.Large) { enemyType = "FlyingEnemyLarge"; } if (myEnemy.size == EnemySize.Medium) { enemyType = "FlyingEnemy"; } if (myEnemy.size == EnemySize.Small) { enemyType = "FlyingEnemySmall"; } break; case EnemyType.Ghost: if (myEnemy.size == EnemySize.Large) { enemyType = "GhostEnemyLarge"; } if (myEnemy.size == EnemySize.Medium) { enemyType = "GhostEnemy"; } if (myEnemy.size == EnemySize.Small) { enemyType = "GhostEnemySmall"; } break; case EnemyType.Ground: if (myEnemy.size == EnemySize.Large) { enemyType = "GroundEnemyLarge"; } if (myEnemy.size == EnemySize.Medium) { enemyType = "Onion"; } if (myEnemy.size == EnemySize.Small) { enemyType = "GroundEnemySmall"; } break; } switch (myEnemy.size) { case EnemySize.Large: AddObjectToHandler("Enemy", new BaseEnemy(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[enemyType]), new Vector2(myEnemy.xPosition * 64, (LevelVariables.HEIGHT - myEnemy.yPosition) * 64 - 128), myEnemy.movementType, myRandom, myPlayer, EnemySize.Large)); break; case EnemySize.Medium: AddObjectToHandler("Enemy", new BaseEnemy(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[enemyType]), new Vector2(myEnemy.xPosition * 64, (LevelVariables.HEIGHT - myEnemy.yPosition) * 64), myEnemy.movementType, myRandom, myPlayer, EnemySize.Medium)); break; case EnemySize.Small: AddObjectToHandler("Enemy", new BaseEnemy(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY[enemyType]), new Vector2(myEnemy.xPosition * 64, (LevelVariables.HEIGHT - myEnemy.yPosition) * 64), myEnemy.movementType, myRandom, myPlayer, EnemySize.Small)); break; } } AddObjectToHandler("Homeworld", new LevelPortal(new Vector2((LevelVariables.WIDTH - 4) * 64, (LevelVariables.HEIGHT - LevelVariables.GROUND_HEIGHT - 1) * 64 - 50), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Portal"]), new HomeWorld(myPlayer), (LevelObjectDictionary["Player"] as Player))); //Sort all of the objects by their zOrder SortByZorder(); }
public HomeWorld(Player myPlayer = null) { levelType = LevelName.Home; if (PlayerStats.firstTime) { PlayerStats.firstTime = false; myPlayer = new Player(new Vector2(0, 0), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["PlayerAnimation"])); PlayerStats.hill = new Level(LevelName.Hills, myPlayer, true); PlayerStats.snow = new Level(LevelName.Ice, myPlayer, true); PlayerStats.desert = new Level(LevelName.Desert, myPlayer, true); PlayerStats.forest = new Level(LevelName.Forest, myPlayer, true); } myPlayer.Position = new Vector2(0, 0); AddObjectToHandler("Player", myPlayer); AddObjectToHandler("Cursor", new Cursor(new Vector2(200, 0), Game1.IMAGE_DICTIONARY["cursor"])); AddObjectToHandler("Ground", new GameObject(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["homeWorld"]), new Vector2(0, 500), "EdgeTile")); AddObjectToHandler("Grass", new GameObject(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Grass"]), new Vector2(0, 485), "Grass")); LevelObjectDictionary["Grass"].FramesPerSecond = 2; LevelObjectDictionary["Grass"].A_BeginAnimation(); LevelObjectDictionary["Grass"].ZOrder = 3; // Don't spawn the portal if the level is complete. AddObjectToHandler("PortalHills", new LevelPortal(new Vector2(1500, 366), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Portal"]), PlayerStats.hill, (LevelObjectDictionary["Player"] as Player))); AddObjectToHandler("PortalIce", new LevelPortal(new Vector2(1700, 366), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Portal"]), PlayerStats.snow, (LevelObjectDictionary["Player"] as Player))); AddObjectToHandler("PortalDesert", new LevelPortal(new Vector2(1900, 366), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Portal"]), PlayerStats.desert, (LevelObjectDictionary["Player"] as Player))); AddObjectToHandler("PortalForest", new LevelPortal(new Vector2(2100, 366), Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Portal"]), PlayerStats.forest, (LevelObjectDictionary["Player"] as Player))); //Close the portals if they player has completed them if (PlayerStats.hillComplete) { (LevelObjectDictionary["PortalHills"] as LevelPortal).Closed = true; } if (PlayerStats.snowComplete) { (LevelObjectDictionary["PortalIce"] as LevelPortal).Closed = true; } if (PlayerStats.desertComplete) { (LevelObjectDictionary["PortalDesert"] as LevelPortal).Closed = true; } if (PlayerStats.forestComplete) { (LevelObjectDictionary["PortalForest"] as LevelPortal).Closed = true; } if (PlayerStats.hillComplete && PlayerStats.snowComplete && PlayerStats.desertComplete && PlayerStats.forestComplete) { Boss myBoss = new Boss(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["BossCenter"]), new Vector2(3050, 200), this, myPlayer); AddObjectToHandler("Boss", myBoss); } skillTree = new SkillTree(new Vector2(800, 400), LevelObjectDictionary["Player"] as Player, this); SortByZorder(); }
public ThrowingDagger(Vector2 velocity, Vector2 startPos) : base(velocity, startPos, Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["Swords"]), "ThrowingDagger", 0) { }
public OneWayBlock(Vector2 posToSet, int toDie) : base(Game1.A_CreateListOfAnimations(Game1.ANIMATION_DICTIONARY["OneWayBlock"]), posToSet, "OneWayBlock") { Game1.OBJECT_HANDLER.currentState.AddObjectToHandler("OneWayBlock", this); timeToDie = toDie; }