Fix GameOver Event
This commit is contained in:
@@ -3,28 +3,43 @@ package funkin.backend.scripting.events;
|
||||
import funkin.game.Character;
|
||||
|
||||
final class GameOverEvent extends CancellableEvent {
|
||||
/**
|
||||
* Character which died. Default to `boyfriend`.
|
||||
*/
|
||||
public var character:Character;
|
||||
/**
|
||||
* The X pos of where the gameover character will be.
|
||||
*/
|
||||
public var x:Float;
|
||||
|
||||
/**
|
||||
* Character ID (name) for game over. Default to whatever is specified in the character's XML.
|
||||
*/
|
||||
public var deathCharID:String;
|
||||
/**
|
||||
* The Y pos of where the gameover character will be.
|
||||
*/
|
||||
public var y:Float;
|
||||
|
||||
/**
|
||||
* Song for the game over screen. Default to `this.gameOverSong` (`gameOver`)
|
||||
*/
|
||||
public var gameOverSong:String;
|
||||
/**
|
||||
* Character which died. Default to `boyfriend`.
|
||||
*/
|
||||
public var character:Character;
|
||||
|
||||
/**
|
||||
* SFX at the beginning of the game over (Mic drop). Default to `this.lossSFX` (`gameOverSFX`)
|
||||
*/
|
||||
public var lossSFX:String;
|
||||
/**
|
||||
* Character ID (name) for game over. Default to whatever is specified in the character's XML.
|
||||
*/
|
||||
public var deathCharID:String;
|
||||
|
||||
/**
|
||||
* SFX played whenever the player retries. Defaults to `retrySFX` (`gameOverEnd`)
|
||||
*/
|
||||
public var retrySFX:String;
|
||||
/**
|
||||
* If the character has isPlayer
|
||||
*/
|
||||
public var isPlayer:Bool;
|
||||
|
||||
/**
|
||||
* Song for the game over screen. Default to `this.gameOverSong` (`gameOver`)
|
||||
*/
|
||||
public var gameOverSong:String;
|
||||
|
||||
/**
|
||||
* SFX at the beginning of the game over (Mic drop). Default to `this.lossSFX` (`gameOverSFX`)
|
||||
*/
|
||||
public var lossSFX:String;
|
||||
|
||||
/**
|
||||
* SFX played whenever the player retries. Defaults to `retrySFX` (`gameOverEnd`)
|
||||
*/
|
||||
public var retrySFX:String;
|
||||
}
|
||||
@@ -1246,8 +1246,11 @@ class PlayState extends MusicBeatState
|
||||
*/
|
||||
public function gameOver(?character:Character, ?deathCharID:String, ?gameOverSong:String, ?lossSFX:String, ?retrySFX:String) {
|
||||
var event:GameOverEvent = scripts.event("onGameOver", EventManager.get(GameOverEvent).recycle(
|
||||
character == null ? 0 : character.x,
|
||||
character == null ? 0 : character.y,
|
||||
character.getDefault(opponentMode ? dad : boyfriend),
|
||||
deathCharID.getDefault(character != null ? character.gameOverCharacter : "bf-dead"),
|
||||
character != null ? character.isPlayer : true,
|
||||
gameOverSong.getDefault(this.gameOverSong),
|
||||
lossSFX.getDefault(this.lossSFX),
|
||||
retrySFX.getDefault(this.retrySFX)
|
||||
@@ -1266,9 +1269,9 @@ class PlayState extends MusicBeatState
|
||||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
openSubState(new GameOverSubstate(character == null ? 0 : character.x, character == null ? 0 : character.y, deathCharID, character != null ? character.isPlayer : true, gameOverSong, lossSFX, retrySFX));
|
||||
openSubState(new GameOverSubstate(event.x, event.y, event.deathCharID, event.isPlayer, event.gameOverSong, event.lossSFX, event.retrySFX));
|
||||
|
||||
scripts.event("onGameOver", event);
|
||||
scripts.event("onPostGameOver", event);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user