void checkIfItemIsPressed() { foreach (Item item in listOfItemsInInventory) { if (MyGame.CheckMouseInRectClick(item)) { if (item.selected == false) { foreach (Item thing in listOfItemsInInventory) { if (thing != item) { thing.selected = false; } else { thing.selected = true; } } id = item.id; } else { item.selected = false; id = 0; } } } }
void Update() { if (MyGame.CheckMouseInRectClick(next)) { NextFrame(); } }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // CreateCredits() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void CreateCredits() { DestroyStartMenu(); MyGame mygame = game as MyGame; mygame.CreateControlsMenu(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // GoBackToStartMenu() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void GoBackToStartMenu() { DestroyControlsMenu(); MyGame mygame = game as MyGame; mygame.CreateMenu(); }
public ScorePage(double scoreNumber) : base(GetAssets.GetCorrectDeathPage(scoreNumber)) { SetScaleXY(MyGame.OldX() / width, MyGame.OldY() / height); TextBox score = new TextBox(game.width, game.height, 0, 0); AddChild(score); score.SetText("your score: " + scoreNumber, MyGame.OldX() / 2.5f, MyGame.OldY() * 1.7f / 2.5f); }
/// <summary> /// Create a new MouseHandler for the given target. /// </summary> /// <param name="target">Target.</param> public MMouseHandler(GameObject target) { _target = target; _game = (MyGame)_target.game; _game.OnAfterStep += HandleOnStep; _lastX = Input.mouseX; _lastY = Input.mouseY; }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // GoBackToStartMenu() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void GoBackToVictoryMenu() { DestroyCreditsMenu(); MyGame mygame = game as MyGame; mygame.CreateVictoryScreen(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // CreateGame() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void CreateGame() { DestroyStartMenu(); MyGame mygame = game as MyGame; mygame.CreateLevel1(); mygame.startMusic(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // GoBackToStartMenu() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void GoBackToStartMenu() { DestroyVictoryScreen(); MyGame mygame = game as MyGame; mygame.ResetWholeGame(); mygame.CreateMenu(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // CreateCreditsMenu() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void CreateCreditsMenu() { DestroyVictoryScreen(); MyGame mygame = game as MyGame; mygame.ResetWholeGame(); mygame.CreateCreditsMenu(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // GoBackToStartMenu() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void GoBackToStartMenu() { DestroyGameOver(); MyGame mygame = game as MyGame; mygame.ResetWholeGame(); mygame.CreateMenu(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // CheckForNewLevel() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void CheckForNewLevel() { if (player.x >= 13500) { MyGame mygame = game as MyGame; LateDestroy(); LateRemove(); mygame.CreateBossLevel(); } }
public bool checkIfItemIsOverlapped() { foreach (Item item in listOfItemsInInventory) { if (MyGame.CheckMouseInRect(item)) { return(true); } } return(false); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // HandleGameOver() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void HandleGameOver() { if (Globals.health_player == 0 && Globals.playerIsDead == false) { Globals.playerIsDead = true; MyGame mygame = game as MyGame; mygame.GameOver(); _deathSound.Play(); } }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // RestartGame() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void RestartGame() { DestroyVictoryScreen(); MyGame mygame = game as MyGame; mygame.ResetWholeGame(); mygame.CreateLevel1(); mygame.startMusic(); Globals.bossIsDead = false; }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // RestartLevel() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void RestartLevel() { DestroyGameOver(); MyGame mygame = game as MyGame; mygame.ResetWholeGame(); mygame.CreateLevel1(); mygame.startMusic(); Globals.bossIsDead = false; }
void goBack() { if (MyGame.CheckMouseInRectClick(downArrow)) { isActive = false; level.isInScene = false; visible = false; if (HasChild(shop)) { RemoveChild(shop); } // makeTutorialDissapear(); } }
public Level(MyGame mygame, int width, int height) : base() { _mygame = mygame; this.x = 0; this.y = 0; _screenHeight = height; _screenWidth = width; _lvl = this; _backgroundChanel = _backgroundMusic.Play(); _backgroundChanel.Volume = 0.3f; }
public void OnCollision(GameObject other) { if (other is Enemy) { Enemy enemy = other as Enemy; enemy.Destroy(); MyGame myGame = game as MyGame; myGame.AddScore(); } else if (other is Crate) { Destroy(); } }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // HandleDeath() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void HandleDeath() { if (Globals.health_boss == 0 && Globals.bossIsDead == false) { Globals.bossIsDead = true; MyGame mygame = game as MyGame; mygame.CreateVictoryScreen(); if (Globals.bossDeathSoundHasPlayed == false) { _deathSound.Play(); Globals.bossDeathSoundHasPlayed = true; } } }
public InfoScreen(MyGame mygame) : base("HUD/info page (1).png") { _backgroundChanel = _backgroundMusic.Play(); _backgroundChanel.Volume = 0.5f; _mygame = mygame; this.width = game.width; this.height = game.height; _startButton.x = _width * 0.6f; _startButton.y = _height * 0.99f; _quitButton.x = _width * 0.8f; _quitButton.y = _height * 0.99f; AddChild(_startButton); AddChild(_quitButton); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // HandleBorders() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void HandleBorders() { MyGame mygame = game as MyGame; if (mygame.level1IsActive == true || mygame.level2IsActive == true) { x = Mathf.Clamp(x, 700, 13700); } if (Globals.levelBossIsActive == true) { x = Mathf.Clamp(x, (0 + width / 2), (1440 - width / 2)); } y = Mathf.Clamp(y, (0), (830)); if (y >= (830)) { isLanded = true; } }
//void makeTutorialDissapear() //{ // if (_tutorial != null) // { // _tutorial.BecomeInvisible(); // } //} //void makeTutorialAppear() //{ // if (_tutorial != null) // { // _tutorial.BecomeVisible(); // // _tutorial.maxFrameToChange++; // } //} //void ChangeTutorialMaxFrame() //{ // if (_tutorial != null) // { // _tutorial.maxFrameToChange=tutorialIndex; // } //} //void ChangeTutorialFrame() //{ // if (_tutorial != null) // { // _tutorial.currentFrame++; // } //} void buyAquarium() { //Console.WriteLine(_tutorial.visible); if (MyGame.CheckMouseInRectClick(clickToBuy)) { if (level.currencySystem.money >= priceOfAquarium) { clickToBuy.LateDestroy(); isBought = true; AddChild(inv); level.currencySystem.RemoveMoney(priceOfAquarium); repairAquarium.Play(); //if (_tutorial.visible == true) //{ // ChangeTutorialFrame(); //} //tutorialIndex += 1; //ChangeTutorialMaxFrame(); } } }
void Update() { if (visible == true) { foreach (Fish fish in fishList) { if (MyGame.CheckMouseInRectClick(fish.buyToUnlock)) { if (_level.currencySystem.money >= fish.coinValue) { if (fish.isUnlocked == false) { buyFish.Play(); _level.currencySystem.RemoveMoney(fish.coinValue); fish.Unlock(); _level.journal.AddFish(fish); } } } } } }
public void CreateWave(int pCurrentLevel, int pCurrentColumn) { if (pCurrentLevel == 1) { levelDataPointer = level1; int tile = levelDataPointer[pCurrentColumn]; if (pCurrentColumn < levelDataPointer.GetLength(0)) { Enemy enemy = new Enemy(1000, 300); AddChild(enemy); } if (pCurrentColumn == levelDataPointer.GetLength(0) - 1) { MyGame myGame = game as MyGame; myGame.EndOfWave(); } } if (pCurrentLevel == 2) { levelDataPointer = level2; int tile = levelDataPointer[pCurrentColumn]; if (pCurrentColumn < levelDataPointer.GetLength(0)) { Enemy enemy = new Enemy(1000, 300); AddChild(enemy); } if (pCurrentColumn == levelDataPointer.GetLength(0) - 1) { MyGame myGame = game as MyGame; myGame.EndOfWave(); } } }
public MainMenu(MyGame mygame) : base("HUD/menu.png") { _backgroundChanel = _backgroundMusic.Play(); _backgroundChanel.Volume = 0.5f; _mygame = mygame; this.width = game.width; this.height = game.height; _startButton.x = game.width * 0.35f; _startButton.y = game.height * 0.75f; _infoButton.x = game.width * 0.55f; _infoButton.y = game.height * 0.75f; _quitButton.x = game.width * 0.75f; _quitButton.y = game.height * 0.75f; AddChild(_startButton); AddChild(_infoButton); AddChild(_quitButton); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // HandleClickButton() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void HandleClickButton() { if (Input.GetMouseButtonUp(0)) { if (_start_button.HitTestPoint(Input.mouseX, Input.mouseY)) { CreateGame(); } if (_credits_button.HitTestPoint(Input.mouseX, Input.mouseY)) { CreateCredits(); } if (_quit_button.HitTestPoint(Input.mouseX, Input.mouseY)) { MyGame mygame = game as MyGame; mygame.quitIsPressed = true; MyGame.timeSince = Time.now; } } }
void Update() { canvas.graphics.Clear(Color.Transparent); if (isVisible) { canvas.graphics.DrawString(text, font, Brushes.Black, canvas.width / 2 - 200, 20); if (MyGame.CheckMouseInRectClick(skip) && HasChild(skip)) { isVisible = false; level.SetInTutorial(false); parent.RemoveChild(this); } if (MyGame.CheckMouseInRectClick(next) && HasChild(next)) { count++; if (count > 10) { isVisible = false; level.SetInTutorial(false); parent.RemoveChild(this); } } switch (count) { case 0: text = "Hello and welcome to your\nnew aquarium. This is the\nmain hub. From here you\ncan see all " + "of your aquariums\nand you can also repair them\nto get access to new\ntypes of fish."; break; case 1: text = "First you need to buy\nyour first aquarium.\nThankfully, you have enough\nmoney to do so. Click on\nthe aquarium to the left\nto enter it."; RemoveChild(next); break; case 2: text = "Good Job! This is the\nfirst aquarium. Later you\nwill be able to look at\nyour fishes here. Click on\nthe sign to purchase your\nfirst aquarium."; break; case 3: text = "Congratulations on your\nnew Aquarium. But it seems\na little dirty. Click on\nthe sponge on the right and\nuse it to wipe the stains\nfrom the glass.Beware as\nstains could be behind\nthis tutorial"; break; case 4: text = "Perfect. Now you just\nneed a fish and you will get the\naquarium fully working. To buy\nfish you need to click\non the shop icon\nto the right."; break; case 5: text = "This is the shop. Here you\ncan buy new fish. The choice\nof fish depends on the type\nof aquarium you're in."; AddChild(next); break; case 6: RemoveChild(next); text = "Now use the rest of\nyour money to buy the\nEuropean Perch by clicking\non the buy button."; break; case 7: text = "Good job, you bought your\nfirst fish! Fish create\ndirt and need to be fed\nfrom time to time. Click on\nthe close button to proceed."; break; case 8: text = "You can see that the fish\nhas a bubble next to it. That\nmeans that the fish\nis hungry. To feed\nhim, click on the food\ncontainer to the right and\nclick anywhere in the level\nto spread some fish food"; RemoveChild(next); break; case 9: text = "As you can see the\nfish goes towards the food\nand will produce a coin.\nFish only produce coins when\nthey" + "are fed and the\naquarium is clean. Coins can\nbe used to buy more\nfish and aquariums."; AddChild(next); break; case 10: text = "One last thing before\nyou go. The journal on the\n right includes \ninformation to all fish\nyou collect. Now go\nand have fun!"; break; } } }