Advertisement
Pinacoin

BBPANZU END SCREEN CODE

Apr 25th, 2021
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. BBPANZU CODE REUSE
  2. (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!)
  3.  
  4. package;
  5. import flixel.*;
  6. import flixel.util.FlxColor;
  7. import flixel.util.FlxTimer;
  8.  
  9. /**
  10. * ...
  11. * @author bbpanzu
  12. */
  13. class EndingState extends FlxState
  14. {
  15.  
  16. var _goodEnding:Bool = false;
  17.  
  18. public function new(goodEnding:Bool = true)
  19. {
  20. super();
  21. _goodEnding = goodEnding;
  22.  
  23. }
  24.  
  25. override public function create():Void
  26. {
  27. super.create();
  28. var end:FlxSprite = new FlxSprite(0, 0);
  29. if (_goodEnding){
  30. end.loadGraphic(Paths.image("image name"));
  31. FlxG.sound.playMusic(Paths.music("goodEnding"),1,false);
  32. FlxG.camera.fade(FlxColor.BLACK, 0.8, true);
  33. }else{
  34. if(FlxG.random.bool(70)){
  35. end.loadGraphic(Paths.image("image name"));
  36. FlxG.sound.playMusic(Paths.music("badEnding"), 1, false);
  37. FlxG.camera.fade(FlxColor.BLACK, 0.8, true);
  38. }else{
  39. end.loadGraphic(Paths.image("image name"));
  40. FlxG.sound.playMusic(Paths.music("peanut"), 1, false);
  41. }
  42. }
  43. add(end);
  44.  
  45.  
  46. new FlxTimer().start(8, endIt);
  47.  
  48. }
  49.  
  50. override public function update(elapsed:Float):Void
  51. {
  52. super.update(elapsed);
  53.  
  54. if (FlxG.keys.pressed.ENTER){
  55. endIt();
  56. }
  57.  
  58. }
  59.  
  60.  
  61. public function endIt(e:FlxTimer=null){
  62. trace("ENDING");
  63. FlxG.switchState(new StoryMenuState());
  64. }
  65.  
  66. }
  67.  
  68. (Then, in PlayState.hx, starting at if (isStoryMode):)
  69.  
  70. if (isStoryMode)
  71. {
  72. campaignScore += Math.round(songScore);
  73.  
  74. storyPlaylist.remove(storyPlaylist[0]);
  75.  
  76. if (storyPlaylist.length <= 0)
  77. {
  78.  
  79. if (curSong == "song name"){
  80. FlxG.switchState(new EndingState(accuracy >= 70));
  81.  
  82.  
  83. if (accuracy >= 70){
  84.  
  85. FlxG.sound.playMusic(Paths.music("music name"),1,false);
  86. }else{
  87. FlxG.sound.playMusic(Paths.music("music name"),1,false);
  88. }
  89.  
  90.  
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement