Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BBPANZU CODE REUSE
- (copy everything below, make a new .hx file called EndingState. This paste is from Kade Engine 1.4.1. This gives the illusion that the good ending/bad ending feature doesn't exist, but if you want that, make sure you make the image directories different!)
- package;
- import flixel.*;
- import flixel.util.FlxColor;
- import flixel.util.FlxTimer;
- /**
- * ...
- * @author bbpanzu
- */
- class EndingState extends FlxState
- {
- var _goodEnding:Bool = false;
- public function new(goodEnding:Bool = true)
- {
- super();
- _goodEnding = goodEnding;
- }
- override public function create():Void
- {
- super.create();
- var end:FlxSprite = new FlxSprite(0, 0);
- if (_goodEnding){
- end.loadGraphic(Paths.image("image name"));
- FlxG.sound.playMusic(Paths.music("goodEnding"),1,false);
- FlxG.camera.fade(FlxColor.BLACK, 0.8, true);
- }else{
- if(FlxG.random.bool(70)){
- end.loadGraphic(Paths.image("image name"));
- FlxG.sound.playMusic(Paths.music("badEnding"), 1, false);
- FlxG.camera.fade(FlxColor.BLACK, 0.8, true);
- }else{
- end.loadGraphic(Paths.image("image name"));
- FlxG.sound.playMusic(Paths.music("peanut"), 1, false);
- }
- }
- add(end);
- new FlxTimer().start(8, endIt);
- }
- override public function update(elapsed:Float):Void
- {
- super.update(elapsed);
- if (FlxG.keys.pressed.ENTER){
- endIt();
- }
- }
- public function endIt(e:FlxTimer=null){
- trace("ENDING");
- FlxG.switchState(new StoryMenuState());
- }
- }
- (Then, in PlayState.hx, starting at if (isStoryMode):)
- if (isStoryMode)
- {
- campaignScore += Math.round(songScore);
- storyPlaylist.remove(storyPlaylist[0]);
- if (storyPlaylist.length <= 0)
- {
- if (curSong == "song name"){
- FlxG.switchState(new EndingState(accuracy >= 70));
- if (accuracy >= 70){
- FlxG.sound.playMusic(Paths.music("music name"),1,false);
- }else{
- FlxG.sound.playMusic(Paths.music("music name"),1,false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement