//Constructor public Gold(Texture2D gemImage, int x, int y, int width, int height, GameScreen gameScreen, SoundEffect snd) { coinSound = snd; gem = new Rectangle(x, y, width, height); this.gemImage = gemImage; this.gameScreen = gameScreen; }
public Bullet(Texture2D image, int x, int y, int width, int height, Enemy enemy, Game game, GameScreen gameScreen) { //Setting isVisible to true. It won't be false until it moves off the screen isVisible = true; bullet = new Rectangle(x, y, width, height); this.image = image; this.enemy = enemy; this.game = game; this.gameScreen = gameScreen; timeTillFire = 200; }
public Goal(Texture2D texture, int x, int y, int width, int height, Game1 game1, GameScreen gs) { game = game1; ls = new LevelScreen(game); theGame = game; save = new SaveInfo(); state = new GameState(game); rect = new Rectangle(x, y, width, height); xPostion = x; yPostion = y; this.width = width; this.height = height; goalTexture = texture; gameScreen = gs; }
//Constructor public PauseScreen(Game1 game1, GameScreen currentGame) { game = game1;// assigns game1 to game gameState = new GameState(game); // creates new gamestate object and assigns it to gameState font1 = game.Content.Load<SpriteFont>("Font1"); // loads Font1 lastState = Keyboard.GetState();// sets keyboard state gameScreen = currentGame; // sets gameScreen to current Gamescreen screenWidth = 1000; //sets width to 1000 screenHeight = 800; //sets height to 800 button = 0; // load all the images title = game.Content.Load<Texture2D>("pauseTitle"); continue1 = game.Content.Load<Texture2D>("continue1"); continue2 = game.Content.Load<Texture2D>("continue2"); options1 = game.Content.Load<Texture2D>("options1"); options2 = game.Content.Load<Texture2D>("options2"); howTo1 = game.Content.Load<Texture2D>("instruction1"); howTo2 = game.Content.Load<Texture2D>("instruction2"); screen = game.Content.Load<Texture2D>("pause"); }
//starts a new game using specific lvl and switch screen to game screen public void StartGame(string lvlFile, string lvlName) { gameScreen = new GameScreen(game, lvlFile, lvlName); // makes new gamescreen currentScreen = Screen.GameScreen; // sets current screen to game screen }
//starts a new game and switch screen to game screen //Methods public void StartGame() { string lvlName = "level1.txt"; gameScreen = new GameScreen(game, lvlName, "level1"); // makes new gamescreen currentScreen = Screen.GameScreen; // sets current screen to game screen }
//resumes game when it is paused public void ResumeGame(GameScreen currentGame) { gameScreen = currentGame; currentScreen = Screen.GameScreen; pauseScreen = null; }
//pauses game public void PauseGame(Game1 game1, GameScreen currentGame) { pauseScreen = new PauseScreen(game1, currentGame); currentScreen = Screen.PauseScreen; }
public void EndGame(string level) { string currentLvl = gameScreen.LevelFile; string levelName = gameScreen.LevelName; gameScreen = null; endLevelScreen = new EndLevelScreen(game, level, currentLvl, levelName); currentScreen = Screen.EndLevelScreen; }
//Constructor public Gem(Texture2D gemImage, int x, int y, int width, int height, GameScreen gameScreen, bool isVisible) { this.isVisible = isVisible; this.gemImage = gemImage; this.gameScreen = gameScreen; }
//Constructor public Enemy(Texture2D enemyImage, int x, int y, int width, int height, Game1 game, GameScreen gameScreen, bool top, List <Bullet> bulletList) { enemyRect = new Rectangle(x, y, width, height); this.enemyImage = enemyImage; this.game = game; this.gameScreen = gameScreen; this.x = x; this.y = y; this.width = width; this.height = height; this.top = top; this.bulletList = bulletList; myBullet = new Bullet(game.bulletSprite, x, y, game.bulletSprite.Width, game.bulletSprite.Height, this, game, gameScreen); enemyPathEnd = gameScreen.epe; }
// constructor /// <summary> /// Sets up the default values. /// </summary> /// <param name="plrTx"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="wid"></param> /// <param name="hgt"></param> public Player(Texture2D plrTx, int x, int y, int wid, int hgt, List<Rectangle> colls, Game1 game1, GameScreen gS, Enemy enemy, Platform platform) { game = game1; oldState = Keyboard.GetState(); playerTexture = plrTx; width = wid; height = hgt; playerRect = new Rectangle(x, y, width, height); xPostion = x; yPostion = y; position = new Vector2(x, y); velocity = new Vector2(); hasJumped = false; currentState = State.Still; collisionsToCheck = colls; backwards = game.playerSprite_Backwards; gameScreen = gS; grappleEndpoint = new Vector2(playerRect.X, playerRect.Y); isGrappled = false; isStunned = false; timeSinceStun = 0; //Kasey added this // Alex added this... just the part of the comment mind you nothing else this.enemy = enemy; this.platform = platform; //images back1 = game.Content.Load<Texture2D>("playerBack2"); back2 = game.Content.Load<Texture2D>("playerBack3"); forward1 = game.Content.Load<Texture2D>("playerForward2"); forward2 = game.Content.Load<Texture2D>("playerForward3"); frame = 0; count = 0; if (MonitorSize.height > 1080) { JUMP_STRENGTH = 24; MAX_SPEED = 12; height += 32; width += 18; } else if (MonitorSize.height < 1080) { JUMP_STRENGTH = 18; MAX_SPEED = 9; height -= 32; width -= 18; } }
// constructor /// <summary> /// Sets up the default values. /// </summary> /// <param name="plrTx"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="wid"></param> /// <param name="hgt"></param> public Player(Texture2D plrTx, int x, int y, int wid, int hgt, List <Rectangle> colls, Game1 game1, GameScreen gS, Enemy enemy, Platform platform) { game = game1; oldState = Keyboard.GetState(); playerTexture = plrTx; width = wid; height = hgt; playerRect = new Rectangle(x, y, width, height); xPostion = x; yPostion = y; position = new Vector2(x, y); velocity = new Vector2(); hasJumped = false; currentState = State.Still; collisionsToCheck = colls; backwards = game.playerSprite_Backwards; gameScreen = gS; grappleEndpoint = new Vector2(playerRect.X, playerRect.Y); isGrappled = false; isStunned = false; timeSinceStun = 0; //Kasey added this // Alex added this... just the part of the comment mind you nothing else this.enemy = enemy; this.platform = platform; //images back1 = game.Content.Load <Texture2D>("playerBack2"); back2 = game.Content.Load <Texture2D>("playerBack3"); forward1 = game.Content.Load <Texture2D>("playerForward2"); forward2 = game.Content.Load <Texture2D>("playerForward3"); frame = 0; count = 0; if (MonitorSize.height > 1080) { JUMP_STRENGTH = 24; MAX_SPEED = 12; height += 32; width += 18; } else if (MonitorSize.height < 1080) { JUMP_STRENGTH = 18; MAX_SPEED = 9; height -= 32; width -= 18; } }