-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTitleState.hx
More file actions
815 lines (703 loc) · 23.3 KB
/
TitleState.hx
File metadata and controls
815 lines (703 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
package;
#if desktop
import Discord.DiscordClient;
import sys.thread.Thread;
#end
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.input.keyboard.FlxKey;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import haxe.Json;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
#if MODS_ALLOWED
import sys.FileSystem;
import sys.io.File;
#end
import options.GraphicsSettingsSubState;
//import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.graphics.frames.FlxFrame;
import flixel.group.FlxGroup;
import flixel.input.gamepad.FlxGamepad;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxSound;
import flixel.system.ui.FlxSoundTray;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import lime.app.Application;
import openfl.Assets;
import dge.shaders.ColorSwap;
using StringTools;
typedef TitleData =
{
titlex:Float,
titley:Float,
startx:Float,
starty:Float,
gfx:Float,
gfy:Float,
backgroundSprite:String,
bpm:Int
}
class TitleState extends MusicBeatState
{
public static var muteKeys:Array<FlxKey> = [FlxKey.ZERO];
public static var volumeDownKeys:Array<FlxKey> = [FlxKey.NUMPADMINUS, FlxKey.MINUS];
public static var volumeUpKeys:Array<FlxKey> = [FlxKey.NUMPADPLUS, FlxKey.PLUS];
public static var initialized:Bool = false;
var blackScreen:FlxSprite;
var credGroup:FlxGroup;
var credTextShit:Alphabet;
var textGroup:FlxGroup;
var ngSpr:FlxSprite;
var titleTextColors:Array<FlxColor> = [0xFF33FFFF, 0xFF3333CC];
var titleTextAlphas:Array<Float> = [1, .64];
var curWacky:Array<String> = [];
var wackyImage:FlxSprite;
#if TITLE_SCREEN_EASTER_EGG
var easterEggKeys:Array<String> = [
'SHADOW', 'RIVER', 'SHUBS', 'BBPANZU'
];
var allowedKeys:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var easterEggKeysBuffer:String = '';
#end
var mustUpdate:Bool = false;
public static var confusedLOL:Bool = false;
var titleJSON:TitleData;
public static var updateVersion:String = '';
override public function create():Void
{
Paths.clearStoredMemory();
Paths.clearUnusedMemory();
#if LUA_ALLOWED
Paths.pushGlobalMods();
#end
// Just to load a mod on start up if ya got one. For mods that change the menu music and bg
WeekData.loadTheFirstEnabledMod();
//trace(path, FileSystem.exists(path));
/*#if (polymod && !html5)
if (sys.FileSystem.exists('mods/')) {
var folders:Array<String> = [];
for (file in sys.FileSystem.readDirectory('mods/')) {
var path = haxe.io.Path.join(['mods/', file]);
if (sys.FileSystem.isDirectory(path)) {
folders.push(file);
}
}
if(folders.length > 0) {
polymod.Polymod.init({modRoot: "mods", dirs: folders});
}
}
#end*/
FlxG.game.focusLostFramerate = 60;
FlxG.sound.muteKeys = muteKeys;
FlxG.sound.volumeDownKeys = volumeDownKeys;
FlxG.sound.volumeUpKeys = volumeUpKeys;
FlxG.keys.preventDefaultKeys = [TAB];
PlayerSettings.init();
curWacky = FlxG.random.getObject(getIntroTextShit());
// DEBUG BULLSHIT
swagShader = new ColorSwap();
super.create();
FlxG.save.bind('funkin', 'ninjamuffin99');
ClientPrefs.loadPrefs();
#if CHECK_FOR_UPDATES
if(ClientPrefs.checkForUpdates && !closedState) {
trace('checking for update');
var http = new haxe.Http("https://raw.githubusercontent.com/DibyoExcel/Dragon-Engine/refs/heads/main/version.txt");
http.onData = function (data:String)
{
updateVersion = data.split('\n')[0].trim();
var versionInt = updateVersion.split('.').join("");
var curVer = Application.current.meta.get('version').split('.').join("");
trace('version online: ' + updateVersion + ', your version: ' + Application.current.meta.get('version'));
var intVersionInt = Std.parseInt(versionInt);
var intCurVer = Std.parseInt(curVer);
if (intCurVer < intVersionInt) {
trace('version aret matching');
mustUpdate = true;
} else if (intCurVer > intVersionInt) {//when dev joke even though impossible to happen
trace('i wonder where you get this unrelease version come from... or... are you Dev?');//joke when people get unexisted or too new that official not even release version yet, lol
confusedLOL = true;
}
/*updateVersion = getMJMNGit[0] + "." + getMJMNGit[1] + ".X";
var splitVersion = Application.current.meta.get('version').split('.');
var getMinotAndMajor = splitVersion[0] + "." + splitVersion[1] + '.X';
var curVersion:String = getMinotAndMajor;
trace('version online: ' + updateVersion + ', your version: ' + curVersion);
var localMajor = splitVersion[0];
var localMinor = splitVersion[1];
var onlineMajor = getMJMNGit[0];
var onlineMinor = getMJMNGit[1];
if (localMajor < onlineMajor || (localMajor == onlineMajor && localMinor < onlineMinor) ) {
trace('version aret matching');
mustUpdate = true;
} else if (localMajor > onlineMajor || (localMajor == onlineMajor && localMinor > onlineMinor) ) {//when dev joke even though impossible to happen
trace('i wonder where you get this unrelease version come from... or... are you Dev?');//joke when people get unexisted or too new that official not even release version yet, lol
confusedLOL = true;
}*/
}
http.onError = function (error) {
trace('error: $error');
}
http.request();
}
#end
Highscore.load();
// IGNORE THIS!!!
titleJSON = Json.parse(Paths.getTextFromFile('images/gfDanceTitle.json'));
#if TITLE_SCREEN_EASTER_EGG
if (FlxG.save.data.psychDevsEasterEgg == null) FlxG.save.data.psychDevsEasterEgg = ''; //Crash prevention
switch(FlxG.save.data.psychDevsEasterEgg.toUpperCase())
{
case 'SHADOW':
titleJSON.gfx += 210;
titleJSON.gfy += 40;
case 'RIVER':
titleJSON.gfx += 100;
titleJSON.gfy += 20;
case 'SHUBS':
titleJSON.gfx += 160;
titleJSON.gfy -= 10;
case 'BBPANZU':
titleJSON.gfx += 45;
titleJSON.gfy += 100;
}
#end
if(!initialized)
{
if(FlxG.save.data != null && FlxG.save.data.fullscreen)
{
FlxG.fullscreen = FlxG.save.data.fullscreen;
//trace('LOADED FULLSCREEN SETTING!!');
}
persistentUpdate = true;
persistentDraw = true;
}
if (FlxG.save.data.weekCompleted != null)
{
StoryMenuState.weekCompleted = FlxG.save.data.weekCompleted;
}
FlxG.mouse.visible = false;
#if FREEPLAY
MusicBeatState.switchState(new FreeplayState());
#elseif CHARTING
MusicBeatState.switchState(new ChartingState());
#else
if(FlxG.save.data.flashing == null && !FlashingState.leftState) {
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
MusicBeatState.switchState(new FlashingState());
} else {
#if desktop
if (!DiscordClient.isInitialized)
{
DiscordClient.initialize();
Application.current.onExit.add (function (exitCode) {
DiscordClient.shutdown();
});
}
#end
if (initialized)
startIntro();
else
{
new FlxTimer().start(1, function(tmr:FlxTimer)
{
startIntro();
});
}
}
#end
}
var logoBl:FlxSprite;
var gfDance:FlxSprite;
var danceLeft:Bool = false;
var titleText:FlxSprite;
var swagShader:ColorSwap = null;
function startIntro()
{
if (!initialized)
{
/*var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
diamond.persist = true;
diamond.destroyOnNoUse = false;
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32},
new FlxRect(-300, -300, FlxG.width * 1.8, FlxG.height * 1.8));
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1),
{asset: diamond, width: 32, height: 32}, new FlxRect(-300, -300, FlxG.width * 1.8, FlxG.height * 1.8));
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;*/
// HAD TO MODIFY SOME BACKEND SHIT
// IF THIS PR IS HERE IF ITS ACCEPTED UR GOOD TO GO
// https://github.com/HaxeFlixel/flixel-addons/pull/348
// var music:FlxSound = new FlxSound();
// music.loadStream(Paths.music('freakyMenu'));
// FlxG.sound.list.add(music);
// music.play();
if(FlxG.sound.music == null) {
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
}
}
Conductor.changeBPM(titleJSON.bpm);
persistentUpdate = true;
var bg:FlxSprite = new FlxSprite();
if (titleJSON.backgroundSprite != null && titleJSON.backgroundSprite.length > 0 && titleJSON.backgroundSprite != "none"){
bg.loadGraphic(Paths.image(titleJSON.backgroundSprite));
CoolUtil.fitBackground(bg);
}else{
bg.makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
}
// bg.antialiasing = ClientPrefs.globalAntialiasing;
// bg.setGraphicSize(Std.int(bg.width * 0.6));
// bg.updateHitbox();
add(bg);
logoBl = new FlxSprite(CoolUtil.getXFrom1280P() + titleJSON.titlex, titleJSON.titley);
logoBl.frames = Paths.getSparrowAtlas('logoBumpin');
logoBl.antialiasing = ClientPrefs.globalAntialiasing;
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24, false);
logoBl.animation.play('bump');
logoBl.updateHitbox();
// logoBl.screenCenter();
// logoBl.color = FlxColor.BLACK;
swagShader = new ColorSwap();
gfDance = new FlxSprite(CoolUtil.getXFrom1280P() + titleJSON.gfx, titleJSON.gfy);
var easterEgg:String = FlxG.save.data.psychDevsEasterEgg;
if(easterEgg == null) easterEgg = ''; //html5 fix
switch(easterEgg.toUpperCase())
{
#if TITLE_SCREEN_EASTER_EGG
case 'SHADOW':
gfDance.frames = Paths.getSparrowAtlas('ShadowBump');
gfDance.animation.addByPrefix('danceLeft', 'Shadow Title Bump', 24);
gfDance.animation.addByPrefix('danceRight', 'Shadow Title Bump', 24);
case 'RIVER':
gfDance.frames = Paths.getSparrowAtlas('RiverBump');
gfDance.animation.addByIndices('danceLeft', 'River Title Bump', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
gfDance.animation.addByIndices('danceRight', 'River Title Bump', [29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
case 'SHUBS':
gfDance.frames = Paths.getSparrowAtlas('ShubBump');
gfDance.animation.addByPrefix('danceLeft', 'Shub Title Bump', 24, false);
gfDance.animation.addByPrefix('danceRight', 'Shub Title Bump', 24, false);
case 'BBPANZU':
gfDance.frames = Paths.getSparrowAtlas('BBBump');
gfDance.animation.addByIndices('danceLeft', 'BB Title Bump', [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], "", 24, false);
gfDance.animation.addByIndices('danceRight', 'BB Title Bump', [27, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], "", 24, false);
#end
default:
//EDIT THIS ONE IF YOU'RE MAKING A SOURCE CODE MOD!!!!
//EDIT THIS ONE IF YOU'RE MAKING A SOURCE CODE MOD!!!!
//EDIT THIS ONE IF YOU'RE MAKING A SOURCE CODE MOD!!!!
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
}
gfDance.antialiasing = ClientPrefs.globalAntialiasing;
add(gfDance);
gfDance.shader = swagShader.shader;
add(logoBl);
logoBl.shader = swagShader.shader;
titleText = new FlxSprite(CoolUtil.getXFrom1280P() + titleJSON.startx, titleJSON.starty);
titleText.frames = Paths.getSparrowAtlas('titleEnter');
var animFrames:Array<FlxFrame> = [];
@:privateAccess {
titleText.animation.findByPrefix(animFrames, "ENTER IDLE");
titleText.animation.findByPrefix(animFrames, "ENTER FREEZE");
}
if (animFrames.length > 0) {
newTitle = true;
titleText.animation.addByPrefix('idle', "ENTER IDLE", 24);
titleText.animation.addByPrefix('press', ClientPrefs.flashing ? "ENTER PRESSED" : "ENTER FREEZE", 24);
}
else {
newTitle = false;
titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24);
titleText.animation.addByPrefix('press', "ENTER PRESSED", 24);
}
titleText.antialiasing = ClientPrefs.globalAntialiasing;
titleText.animation.play('idle');
titleText.updateHitbox();
// titleText.screenCenter(X);
add(titleText);
var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo'));
logo.screenCenter();
logo.antialiasing = ClientPrefs.globalAntialiasing;
// add(logo);
// FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
// FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
credGroup = new FlxGroup();
add(credGroup);
textGroup = new FlxGroup();
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
credGroup.add(blackScreen);
credTextShit = new Alphabet(0, 0, "", true);
credTextShit.screenCenter();
// credTextShit.alignment = CENTER;
credTextShit.visible = false;
ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadGraphic(Paths.image('newgrounds_logo'));
add(ngSpr);
ngSpr.visible = false;
ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8));
ngSpr.updateHitbox();
ngSpr.screenCenter(X);
ngSpr.antialiasing = ClientPrefs.globalAntialiasing;
FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG});
if (initialized)
skipIntro();
else
initialized = true;
// credGroup.add(credTextShit);
}
function getIntroTextShit():Array<Array<String>>
{
var fullText:String = '';
#if MODS_ALLOWED
if (FileSystem.exists(Paths.modFolders('data/introText.txt'))) {
fullText = File.getContent(Paths.modFolders('data/introText.txt'));
} else if (FileSystem.exists(Paths.externalPreloadPath('data/introText.txt'))) {
fullText = File.getContent(Paths.externalPreloadPath('data/introText.txt'));
} else {
fullText = Assets.getText(Paths.txt('introText'));
}
#else
fullText = Assets.getText(Paths.txt('introText'));
#end
var firstArray:Array<String> = fullText.split('\n');
var swagGoodArray:Array<Array<String>> = [];
for (i in firstArray)
{
swagGoodArray.push(i.split('--'));
}
return swagGoodArray;
}
var transitioning:Bool = false;
private static var playJingle:Bool = false;
var newTitle:Bool = false;
var titleTimer:Float = 0;
override function update(elapsed:Float)
{
#if sys
if (FlxG.keys.justPressed.ESCAPE #if android || FlxG.android.justPressed.BACK #end) {
lime.app.Application.current.window.alert('Bye!, see you next time.', 'Dragon Engine');
Sys.exit(0);
}
#end
if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time;
// FlxG.watch.addQuick('amp', FlxG.sound.music.amplitude);
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER || controls.ACCEPT;
#if mobile
for (touch in FlxG.touches.list)
{
if (touch.justPressed)
{
pressedEnter = true;
}
}
#end
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.START)
pressedEnter = true;
#if switch
if (gamepad.justPressed.B)
pressedEnter = true;
#end
}
if (newTitle) {
titleTimer += CoolUtil.boundTo(elapsed, 0, 1);
if (titleTimer > 2) titleTimer -= 2;
}
// EASTER EGG
if (initialized && !transitioning && skippedIntro)
{
if (newTitle && !pressedEnter)
{
var timer:Float = titleTimer;
if (timer >= 1)
timer = (-timer) + 2;
timer = FlxEase.quadInOut(timer);
titleText.color = FlxColor.interpolate(titleTextColors[0], titleTextColors[1], timer);
titleText.alpha = FlxMath.lerp(titleTextAlphas[0], titleTextAlphas[1], timer);
}
if(pressedEnter)
{
titleText.color = FlxColor.WHITE;
titleText.alpha = 1;
if(titleText != null) titleText.animation.play('press');
FlxG.camera.flash(ClientPrefs.flashing ? FlxColor.WHITE : 0x4CFFFFFF, 1);
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
transitioning = true;
// FlxG.sound.music.stop();
new FlxTimer().start(1, function(tmr:FlxTimer)
{
if (mustUpdate || confusedLOL) {
MusicBeatState.switchState(new OutdatedState());
} else {
MusicBeatState.switchState(new MainMenuState());
}
closedState = true;
});
// FlxG.sound.play(Paths.music('titleShoot'), 0.7);
}
#if TITLE_SCREEN_EASTER_EGG
else if (FlxG.keys.firstJustPressed() != FlxKey.NONE)
{
var keyPressed:FlxKey = FlxG.keys.firstJustPressed();
var keyName:String = Std.string(keyPressed);
if(allowedKeys.contains(keyName)) {
easterEggKeysBuffer += keyName;
if(easterEggKeysBuffer.length >= 32) easterEggKeysBuffer = easterEggKeysBuffer.substring(1);
//trace('Test! Allowed Key pressed!!! Buffer: ' + easterEggKeysBuffer);
for (wordRaw in easterEggKeys)
{
var word:String = wordRaw.toUpperCase(); //just for being sure you're doing it right
if (easterEggKeysBuffer.contains(word))
{
//trace('YOOO! ' + word);
if (FlxG.save.data.psychDevsEasterEgg == word)
FlxG.save.data.psychDevsEasterEgg = '';
else
FlxG.save.data.psychDevsEasterEgg = word;
FlxG.save.flush();
FlxG.sound.play(Paths.sound('ToggleJingle'));
var black:FlxSprite = new FlxSprite(0, 0).makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
black.alpha = 0;
add(black);
FlxTween.tween(black, {alpha: 1}, 1, {onComplete:
function(twn:FlxTween) {
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
MusicBeatState.switchState(new TitleState());
}
});
FlxG.sound.music.fadeOut();
if(FreeplayState.vocals != null)
{
FreeplayState.vocals.fadeOut();
}
closedState = true;
transitioning = true;
playJingle = true;
easterEggKeysBuffer = '';
break;
}
}
}
}
#end
}
if (initialized && pressedEnter && !skippedIntro)
{
skipIntro();
}
if(swagShader != null)
{
if(controls.UI_LEFT) swagShader.hue -= elapsed * 0.1;
if(controls.UI_RIGHT) swagShader.hue += elapsed * 0.1;
}
super.update(elapsed);
}
function createCoolText(textArray:Array<String>, ?offset:Float = 0)
{
for (i in 0...textArray.length)
{
var money:Alphabet = new Alphabet(0, 0, textArray[i], true);
money.screenCenter(X);
money.y += (i * 60) + 200 + offset;
if(credGroup != null && textGroup != null) {
credGroup.add(money);
textGroup.add(money);
}
}
}
function addMoreText(text:String, ?offset:Float = 0)
{
if(textGroup != null && credGroup != null) {
var coolText:Alphabet = new Alphabet(0, 0, text, true);
coolText.screenCenter(X);
coolText.y += (textGroup.length * 60) + 200 + offset;
credGroup.add(coolText);
textGroup.add(coolText);
}
}
function deleteCoolText()
{
while (textGroup.members.length > 0)
{
credGroup.remove(textGroup.members[0], true);
textGroup.remove(textGroup.members[0], true);
}
}
private var sickBeats:Int = 0; //Basically curBeat but won't be skipped if you hold the tab or resize the screen
public static var closedState:Bool = false;
override function beatHit()
{
super.beatHit();
if(logoBl != null)
logoBl.animation.play('bump', true);
if(gfDance != null) {
danceLeft = !danceLeft;
if (danceLeft)
gfDance.animation.play('danceRight');
else
gfDance.animation.play('danceLeft');
}
if(!closedState) {
sickBeats++;
switch (sickBeats)
{
case 1:
//FlxG.sound.music.stop();
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
case 2:
#if PSYCH_WATERMARKS
createCoolText(['Dragon Engine by'], 15);
#else
createCoolText(['ninja muffin']);
#end
// credTextShit.visible = true;
case 4:
#if PSYCH_WATERMARKS
addMoreText('DubEnderDragon', 15);
#else
addMoreText('present');
#end
// credTextShit.text += '\npresent...';
// credTextShit.addText();
case 5:
deleteCoolText();
// credTextShit.visible = false;
// credTextShit.text = 'In association \nwith';
// credTextShit.screenCenter();
case 6:
#if PSYCH_WATERMARKS
createCoolText(['Not associated', 'with'], -40);
#else
createCoolText(['In association', 'with'], -40);
#end
case 8:
addMoreText('newgrounds', -40);
ngSpr.visible = true;
// credTextShit.text += '\nNewgrounds';
case 9:
deleteCoolText();
ngSpr.visible = false;
// credTextShit.visible = false;
// credTextShit.text = 'Shoutouts Tom Fulp';
// credTextShit.screenCenter();
case 10:
createCoolText([curWacky[0]]);
// credTextShit.visible = true;
case 12:
addMoreText(curWacky[1]);
// credTextShit.text += '\nlmao';
case 13:
deleteCoolText();
// credTextShit.visible = false;
// credTextShit.text = "Friday";
// credTextShit.screenCenter();
case 14:
addMoreText('Friday');
// credTextShit.visible = true;
case 15:
addMoreText('Night');
// credTextShit.text += '\nNight';
case 16:
addMoreText('Funkin'); // credTextShit.text += '\nFunkin';
case 17:
skipIntro();
}
}
}
var skippedIntro:Bool = false;
var increaseVolume:Bool = false;
function skipIntro():Void
{
if (!skippedIntro)
{
if (playJingle) //Ignore deez
{
var easteregg:String = FlxG.save.data.psychDevsEasterEgg;
if (easteregg == null) easteregg = '';
easteregg = easteregg.toUpperCase();
var sound:FlxSound = null;
switch(easteregg)
{
case 'RIVER':
sound = FlxG.sound.play(Paths.sound('JingleRiver'));
case 'SHUBS':
sound = FlxG.sound.play(Paths.sound('JingleShubs'));
case 'SHADOW':
FlxG.sound.play(Paths.sound('JingleShadow'));
case 'BBPANZU':
sound = FlxG.sound.play(Paths.sound('JingleBB'));
default: //Go back to normal ugly ass boring GF
remove(ngSpr);
remove(credGroup);
FlxG.camera.flash(FlxColor.WHITE, 2);
skippedIntro = true;
playJingle = false;
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
return;
}
transitioning = true;
if(easteregg == 'SHADOW')
{
new FlxTimer().start(3.2, function(tmr:FlxTimer)
{
remove(ngSpr);
remove(credGroup);
FlxG.camera.flash(FlxColor.WHITE, 0.6);
transitioning = false;
});
}
else
{
remove(ngSpr);
remove(credGroup);
FlxG.camera.flash(FlxColor.WHITE, 3);
sound.onComplete = function() {
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
transitioning = false;
};
}
playJingle = false;
}
else //Default! Edit this one!!
{
remove(ngSpr);
remove(credGroup);
FlxG.camera.flash(FlxColor.WHITE, 4);
var easteregg:String = FlxG.save.data.psychDevsEasterEgg;
if (easteregg == null) easteregg = '';
easteregg = easteregg.toUpperCase();
#if TITLE_SCREEN_EASTER_EGG
if(easteregg == 'SHADOW')
{
FlxG.sound.music.fadeOut();
if(FreeplayState.vocals != null)
{
FreeplayState.vocals.fadeOut();
}
}
#end
}
skippedIntro = true;
}
}
}