private void LevelComplete() { if (_em._listOfEnemies.Count() == 0) { playMusic.Stop(); if (startedPlaying == true) { levelCompleteMusic.Play(); startedPlaying = false; } } }
public void PlayerDied() { _soundChannel.Stop(); AddChild(_gameOverRectangleUp); AddChild(_gameOverRectangleDown); _playerDied = true; }
//-------------------------------------------------------------------- // Setup Game //-------------------------------------------------------------------- private void StartGame() { Level level = new Level(1, soundVolume); soundChannel.Stop(); game.AddChild(level); LateDestroy(); }
// Checks for mouse input for the buttons. private void MouseInputButtons() { if (Input.GetMouseButtonDown(0)) { if (_mainMenuButton.HitTestPoint(Input.mouseX, Input.mouseY)) { _game.SwitchRoom("Arkanoid"); _backgroundMusicChannel.Stop(); } else if (_quitButton.HitTestPoint(Input.mouseX, Input.mouseY)) { _game.SwitchRoom("Main"); _backgroundMusicChannel.Stop(); this.LateDestroy(); } } }
// Checks for a mouse button press on the button private void MouseInputButtons() { if (Input.GetMouseButtonDown(0)) { if (_startButton.HitTestPoint(Input.mouseX, Input.mouseY)) { if (_game.tickets - 5 > 0) { _game.SwitchRoom("ALevelOne"); _backgroundMusicChannel.Stop(); } } else if (_quitButton.HitTestPoint(Input.mouseX, Input.mouseY)) { _game.SwitchRoom("Main"); _backgroundMusicChannel.Stop(); } } }
//------------------------------------------------------------------------------------------------------------------------ // ROAD RACER //------------------------------------------------------------------------------------------------------------------------ private void LoadRoadRaceMenu() { GXPEngine.OpenGL.GL.glfwSetWindowTitle("The Homebox Arcade - Road Racer"); Console.WriteLine("Loading Race"); if (_mainHub != null) { _mainHub.LateDestroy(); _mainHub = null; _backgroundMusicChannel.Stop(); } if (_rDeathScreen != null) { _rDeathScreen.LateDestroy(); _rDeathScreen = null; } _roadRacer = new MainMenuRoadRacer(this); LateAddChild(_roadRacer); Console.WriteLine("Race Loaded!"); }
public void Update() { if (_playAnimation) { animation(); if (currentFrame == 22) { _playAnimation = false; _channel.Stop(); } } }
//------------------------------------------------------------------------ // RemoveSponge //------------------------------------------------------------------------ private void RemoveSponge() { if (spongeOnScreen == true) { if (spongeClean != null && _option.isSoundPlaying) { spongeClean.Stop(); } RemoveChild(sponge); spongeOnScreen = false; spongeSoundsPlaying = false; } }
//------------------------------------------------------------------------ // RemoveShop //------------------------------------------------------------------------ private void RemoveShop() { if (isShopDisplayed == true) { RemoveChild(shop); if (_option.isSoundPlaying) { openShopSoundChannel.Stop(); } shop.visible = false; isShopDisplayed = false; } }
void Update() { _canvas.graphics.Clear(Color.Transparent); ChangeOpacity(); _canvas.graphics.DrawString("Press V to continue...", _font, Brushes.White, game.width / 2 - 200, game.height / 2 + _canvas.height / 4); if (Input.GetKeyUp(Key.B)) { Environment.Exit(0); } if (Input.GetKeyUp(Key.V)) { _soundChannel.Stop(); _myGame.SetState(MyGame.GameState.OPENINGSCREEN); } }
void Update() { timer = new Timer(6000, DestroyStoryScreen); if (_storyScreen.IsDestroyed()) { RemoveChild(_canvas); _storyScreen2.AddChild(_canvas); AddChild(_storyScreen2); new Timer(6000, DestroyNextStoryScreen); } if (_storyScreen2.IsDestroyed()) { cutSceneDone = true; _storyScreen2.RemoveChild(_canvas); _canvas.Destroy(); AddChild(_controls); } if (Input.GetKeyUp(Key.V) && cutSceneDone) { _soundChannel.Stop(); _controls.Destroy(); _myGame.SetState(MyGame.GameState.LEVEL); } else { if (Input.GetKeyUp(Key.V)) { if (_storyScreen != null) { _storyScreen.Destroy(); AddChild(_controls); } if (_storyScreen2 != null) { _storyScreen2.Destroy(); AddChild(_controls); } } } }
private void grabbed() { float deltaX = _position.x - Input.mouseX; float deltaY = _position.y - Input.mouseY; if (Mathf.Abs(deltaX) <= width / 2 && Mathf.Abs(deltaY) <= height / 2 && Input.GetMouseButtonDown(0)) { _holding = true; Sound effect = new Sound("Slide.wav", true); _channel = effect.Play(); if (_doOnce) { _mouseGrabPoint = new Vec2(deltaX, deltaY); _doOnce = false; } } else if (Input.GetMouseButtonUp(0)) { _doOnce = true; _holding = false; _channel.Stop(); } }
void StopWalk() { SFX.Stop(); }
public void LoadDeathScreen() { _backgroundMusicChannel.Stop(); _game.SwitchRoom("RDeath"); }
private void StopSound() { Sound.Looping = false; Sound.Stop(); }
public void StopMusic() { _musicChannel.Stop(); }
//------------------------------------------------------------------------------------------------------------ // StopSound //------------------------------------------------------------------------------------------------------------ public void StopSound() { _moveSoundChannel.Stop(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // stopMusic() //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public void stopMusic() { _musicchannel.Stop(); }
void StopFrankMusic() { _musicChannel.Stop(); }
void StopKanyeMusic() { _musicChannel.Stop(); }
// Loads the death screen if the player has no lives anymore public void LoadDeathScreen() { _game.SwitchRoom("ADeath"); // Stops the background music _backgroundMusicChannel.Stop(); }
private void StopMusic() { _musicChannel.Stop(); }
void Update() { fpsTimer++; boardWothScore.SetText("" + score, 40); oldBallDistance = ballDistance; _magasIndex++; if (_magasIndex >= _magas.Count) { _magasIndex = 0; } Vec2 differenceVectorMagnete = _magas[_magasIndex].end - _ball.position; Vec2 angledMagnete = _magas[_magasIndex].end - _magas[_magasIndex].start; Vec2 magneteNormal = angledMagnete.Normal(); ballDistance = differenceVectorMagnete.Dot(magneteNormal.Normalized()); if (Mathf.Abs(ballDistance) <= _ball.radius + 18) { Vec2 middle = (_magas[_magasIndex].end + _magas[_magasIndex].start) * 0.5f; Vec2 middletoBall = _ball.position - middle; if (middletoBall.Length() < (angledMagnete.Length() / 2) + _ball.radius + 18) { if (middletoBall.Length() > 0) { Vec2 distance = _magas[_magasIndex].start - _ball.position; _ball.velocity += distance.Normalized() * 1.5f; } } } else if (Mathf.Abs(ballDistance) >= _ball.radius) { _ball.acceleration.y = 1; } if (Input.GetMouseButtonDown(0) & menuButton.HitTestPoint(Input.mouseX, Input.mouseY)) { Menu menu = new Menu(level, soundChannel.Volume); game.AddChild(menu); LateDestroy(); soundChannel.Stop(); _clickSound.Play(); } else if (Input.GetMouseButtonDown(0) & _hud.magnetPNG.HitTestPoint(Input.mouseX, Input.mouseY) & trampInConst == false & shelfInConst == false) { magwf.SetOrigin(magwf.width / 2, magwf.height / 2); magwf.SetXY(_hud.bakingPosition.x, _hud.bakingPosition.y); magwf.alpha = 0.4f; _hud.isConstWork = true; magwf.rotation = 0; magnetInConst = true; _clickSound.Play(); } else if (Input.GetMouseButtonDown(0) & _hud.trampolinePNG.HitTestPoint(Input.mouseX, Input.mouseY) & magnetInConst == false & shelfInConst == false) { trampwf.SetOrigin(trampwf.width, 0); trampwf.SetXY(_hud.bakingPosition.x + 64, _hud.bakingPosition.y); trampwf.alpha = 0.4f; _hud.isConstWork = true; trampwf.rotation = 0; trampInConst = true; _clickSound.Play(); } else if (Input.GetMouseButtonDown(0) & _hud.shelfPNG.HitTestPoint(Input.mouseX, Input.mouseY) & trampInConst == false & magnetInConst == false) { shlfwf.SetOrigin(shlfwf.width, 0); shlfwf.alpha = 0.4f; shlfwf.SetXY(_hud.bakingPosition.x + shlfwf.width / 2, _hud.bakingPosition.y); _hud.isConstWork = true; shlfwf.rotation = 0; shelfInConst = true; _clickSound.Play(); } if (_hud.isConstWork == true) { if (magnetInConst == true) { if (Input.GetKey(Key.RIGHT)) { magwf.rotation++; } if (Input.GetKey(Key.LEFT)) { magwf.rotation--; } if (Input.GetKeyDown(Key.SPACE)) { magwf.SetXY(-500, -500); AddMagnete(new Vec2(_hud.bakingPosition.x, _hud.bakingPosition.y), new Vec2(_hud.bakingPosition.x + 1, _hud.bakingPosition.y + 201), magwf.rotation); _hud.isConstWork = false; magnetInConst = false; score -= 20; } } if (trampInConst == true) { if (Input.GetKey(Key.RIGHT)) { trampwf.rotation++; } if (Input.GetKey(Key.LEFT)) { trampwf.rotation--; } if (Input.GetKeyDown(Key.SPACE)) { trampwf.SetXY(-500, -500); AddTrampoline(new Vec2(_hud.bakingPosition.x - 64, _hud.bakingPosition.y), new Vec2(_hud.bakingPosition.x + 64, _hud.bakingPosition.y), trampwf.rotation); score -= 15; _hud.isConstWork = false; trampInConst = false; } } if (shelfInConst == true) { if (Input.GetKey(Key.RIGHT)) { shlfwf.rotation++; } if (Input.GetKey(Key.LEFT)) { shlfwf.rotation--; } if (Input.GetKeyDown(Key.SPACE)) { shlfwf.SetXY(-500, -500); AddShelf(new Vec2(_hud.bakingPosition.x + shlfwf.width / 2, _hud.bakingPosition.y), new Vec2(_hud.bakingPosition.x - shlfwf.width / 2, _hud.bakingPosition.y), shlfwf.rotation); score -= 10; _hud.isConstWork = false; shelfInConst = false; } } if (Input.GetKeyDown(Key.C)) { shelfInConst = false; _hud.isConstWork = false; trampInConst = false; magnetInConst = false; shlfwf.SetXY(-500, -500); magwf.SetXY(-500, -500); trampwf.SetXY(-500, -500); } } if (Input.GetKey(Key.R)) { isGameStarted = false; LoadScene(_startSceneNumber); } if (Input.GetKey(Key.F)) { isGameStarted = false; ResetBall(_startSceneNumber); } if (Input.GetKeyDown(Key.ENTER)) { isAnimStart = true; //isGameStarted = true; } if (isAnimStart == true) { if (fpsTimer % 7.5 == 0) { crane.NextFrame(); } if (crane.currentFrame >= 3) { isGameStarted = true; } if (crane.currentFrame >= 5) { isAnimStart = false; } } if (isGameStarted == true) { _ball.Step(); } if (levelC.HitTestPoint(_ball.position.x, _ball.position.y)) { //isLevelPassed = true; if (_startSceneNumber <= 4) { _startSceneNumber++; oldscore = score; LoadScene(_startSceneNumber); Transit transit = new Transit(oldscore); AddChild(transit); } else { _startSceneNumber = 1; LoadScene(_startSceneNumber); } } if (Input.mouseX >= 0 & Input.mouseX <= game.width & Input.mouseY >= 0 & Input.mouseY <= game.height) { _cursorIMG.SetXY(Input.mouseX, Input.mouseY); } }