forked from DarkDarkDar/Indie-Cross-Recreation-Psych-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayerState.hx
4463 lines (3824 loc) · 127 KB
/
PlayerState.hx
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
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package;
#if desktop
import Discord.DiscordClient;
#end
import Section.SwagSection;
import Song.SwagSong;
import WiggleEffect.WiggleEffectType;
import flixel.FlxBasic;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.effects.FlxTrail;
import flixel.addons.effects.FlxTrailArea;
import flixel.addons.effects.chainable.FlxEffectSprite;
import flixel.addons.effects.chainable.FlxWaveEffect;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.atlas.FlxAtlas;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.ui.FlxBar;
import flixel.util.FlxCollision;
import flixel.util.FlxColor;
import flixel.util.FlxSort;
import flixel.util.FlxStringUtil;
import flixel.util.FlxTimer;
import haxe.Json;
import lime.utils.Assets;
import openfl.display.BlendMode;
import openfl.display.StageQuality;
import openfl.filters.ShaderFilter;
import openfl.utils.Assets as OpenFlAssets;
import editors.ChartingState;
import editors.CharacterEditorState;
import flixel.group.FlxSpriteGroup;
import Achievements;
import StageData;
import FunkinLua;
import DialogueBoxPsych;
import openfl.filters.BitmapFilter;
#if sys
import Sys;
import sys.FileSystem;
import openfl.Assets;
import sys.io.File;
#end
#if mobileC
import ui.Mobilecontrols;
import ui.FlxVirtualPad;
#end
using StringTools;
class PlayState extends MusicBeatState
{
public static var STRUM_X = 42;
public static var STRUM_X_MIDDLESCROLL = -278;
public static var ratingStuff:Array<Dynamic> = [
['You Suck!', 0.2], //From 0% to 19%
['Shit', 0.4], //From 20% to 39%
['Bad', 0.5], //From 40% to 49%
['Bruh', 0.6], //From 50% to 59%
['Meh', 0.69], //From 60% to 68%
['Nice', 0.7], //69%
['Good', 0.8], //From 70% to 79%
['Great', 0.9], //From 80% to 89%
['Sick!', 1], //From 90% to 99%
['Perfect!!', 1] //The value on this one isn't used actually, since Perfect is always "1"
];
#if (haxe >= "4.0.0")
public var modchartTweens:Map<String, FlxTween> = new Map();
public var modchartSprites:Map<String, ModchartSprite> = new Map();
public var modchartTimers:Map<String, FlxTimer> = new Map();
public var modchartSounds:Map<String, FlxSound> = new Map();
#else
public var modchartTweens:Map<String, FlxTween> = new Map<String, FlxTween>();
public var modchartSprites:Map<String, ModchartSprite> = new Map<String, Dynamic>();
public var modchartTimers:Map<String, FlxTimer> = new Map<String, FlxTimer>();
public var modchartSounds:Map<String, FlxSound> = new Map<String, FlxSound>();
#end
//event variables
private var isCameraOnForcedPos:Bool = false;
#if (haxe >= "4.0.0")
public var boyfriendMap:Map<String, Boyfriend> = new Map();
public var dadMap:Map<String, Character> = new Map();
public var gfMap:Map<String, Character> = new Map();
#else
public var boyfriendMap:Map<String, Boyfriend> = new Map<String, Boyfriend>();
public var dadMap:Map<String, Character> = new Map<String, Character>();
public var gfMap:Map<String, Character> = new Map<String, Character>();
#end
public var BF_X:Float = 770;
public var BF_Y:Float = 100;
public var DAD_X:Float = 100;
public var DAD_Y:Float = 100;
public var GF_X:Float = 400;
public var GF_Y:Float = 130;
public static var songSpeed:Float = 0;
public var boyfriendGroup:FlxSpriteGroup;
public var dadGroup:FlxSpriteGroup;
public var gfGroup:FlxSpriteGroup;
public static var curStage:String = '';
public static var isPixelStage:Bool = false;
public static var SONG:SwagSong = null;
public static var isStoryMode:Bool = false;
public static var storyWeek:Int = 0;
public static var storyPlaylist:Array<String> = [];
public static var storyDifficulty:Int = 1;
public var vocals:FlxSound;
public var dad:Character;
public var gf:Character;
public var boyfriend:Boyfriend;
public var notes:FlxTypedGroup<Note>;
public var unspawnNotes:Array<Note> = [];
public var eventNotes:Array<Dynamic> = [];
private var strumLine:FlxSprite;
//Handles the new epic mega sexy cam code that i've done
private var camFollow:FlxPoint;
private var camFollowPos:FlxObject;
private static var prevCamFollow:FlxPoint;
private static var prevCamFollowPos:FlxObject;
private static var resetSpriteCache:Bool = false;
public var strumLineNotes:FlxTypedGroup<StrumNote>;
public var opponentStrums:FlxTypedGroup<StrumNote>;
public var playerStrums:FlxTypedGroup<StrumNote>;
public var grpNoteSplashes:FlxTypedGroup<NoteSplash>;
public var camZooming:Bool = false;
private var curSong:String = "";
var songfont:String = "vcr.ttf";
public var gfSpeed:Int = 1;
public var health:Float = 1;
public var combo:Int = 0;
private var healthBarBG:AttachedSprite;
public var healthBar:FlxBar;
var songPercent:Float = 0;
private var timeBarBG:AttachedSprite;
public var timeBar:FlxBar;
private var generatedMusic:Bool = false;
public var endingSong:Bool = false;
private var startingSong:Bool = false;
private var updateTime:Bool = false;
public static var practiceMode:Bool = false;
public static var usedPractice:Bool = false;
public static var changedDifficulty:Bool = false;
public static var cpuControlled:Bool = false;
var runCutscene:Bool = false;
var botplaySine:Float = 0;
var botplayTxt:FlxText;
public var iconP1:HealthIcon;
public var iconP2:HealthIcon;
public var camHUD:FlxCamera;
public var camJumpscare:FlxCamera;
public var camGame:FlxCamera;
public var camOther:FlxCamera;
public var cameraSpeed:Float = 1;
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var dialogueJson:DialogueFile = null;
var halloweenBG:BGSprite;
var halloweenWhite:BGSprite;
var phillyCityLights:FlxTypedGroup<BGSprite>;
var phillyTrain:BGSprite;
var blammedLightsBlack:ModchartSprite;
var blammedLightsBlackTween:FlxTween;
var phillyCityLightsEvent:FlxTypedGroup<BGSprite>;
var phillyCityLightsEventTween:FlxTween;
var trainSound:FlxSound;
var limoKillingState:Int = 0;
var limo:BGSprite;
var limoMetalPole:BGSprite;
var limoLight:BGSprite;
var limoCorpse:BGSprite;
var limoCorpseTwo:BGSprite;
var bgLimo:BGSprite;
var grpLimoParticles:FlxTypedGroup<BGSprite>;
var grpLimoDancers:FlxTypedGroup<BackgroundDancer>;
var fastCar:BGSprite;
var upperBoppers:BGSprite;
var bottomBoppers:BGSprite;
var santa:BGSprite;
var heyTimer:Float;
var bgGirls:BackgroundGirls;
var wiggleShit:WiggleEffect = new WiggleEffect();
var bgGhouls:BGSprite;
public var songScore:Int = 0;
public var songHits:Int = 0;
public var songMisses:Int = 0;
public var ghostMisses:Int = 0;
public var scoreTxt:FlxText;
var timeTxt:FlxText;
var scoreTxtTween:FlxTween;
public static var campaignScore:Int = 0;
public static var campaignMisses:Int = 0;
public static var seenCutscene:Bool = false;
public static var deathCounter:Int = 0;
public var defaultCamZoom:Float = 1.05;
// how big to stretch the pixel art assets
public static var daPixelZoom:Float = 6;
public var inCutscene:Bool = false;
var songLength:Float = 0;
#if desktop
// Discord RPC variables
var storyDifficultyText:String = "";
var detailsText:String = "";
var detailsPausedText:String = "";
#end
#if mobileC
var mcontrols:Mobilecontrols;
var _pad:FlxVirtualPad;
#end
private var luaArray:Array<FunkinLua> = [];
//Achievement shit
var keysPressed:Array<Bool> = [false, false, false, false];
var boyfriendIdleTime:Float = 0.0;
var boyfriendIdled:Bool = false;
// Lua shit
private var luaDebugGroup:FlxTypedGroup<DebugLuaText>;
public var introSoundsSuffix:String = '';
var vignette:FlxSprite;
var doit:Bool = false;
var hedidit:Bool = false;
var henotdidit:Bool = false;
var spacebarthing:FlxSprite;
var murderbone:FlxSprite;
var dathing2:FlxSprite;
var wallop:FlxSprite;
var cupshid:FlxSprite;
var bendyjump:FlxSprite;
var filters:Array<BitmapFilter> = [];
override public function create()
{
#if MODS_ALLOWED
Paths.destroyLoadedImages(resetSpriteCache);
#end
resetSpriteCache = false;
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
practiceMode = false;
// var gameCam:FlxCamera = FlxG.camera;
camGame = new FlxCamera();
camJumpscare = new FlxCamera();
camHUD = new FlxCamera();
camOther = new FlxCamera();
camJumpscare.bgColor.alpha = 0;
camHUD.bgColor.alpha = 0;
camOther.bgColor.alpha = 0;
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camJumpscare);
FlxG.cameras.add(camHUD);
FlxG.cameras.add(camOther);
grpNoteSplashes = new FlxTypedGroup<NoteSplash>();
FlxCamera.defaultCameras = [camGame];
CustomFadeTransition.nextCamera = camOther;
//FlxG.cameras.setDefaultDrawTarget(camGame, true);
camGame.setFilters(filters);
camGame.filtersEnabled = true;
if (SONG.song.toLowerCase() == 'snake-eyes') {
filters.push(ShadersHandler.chromaticAberration);
ShadersHandler.setChrome(1.5 / 1000);
}
persistentUpdate = true;
persistentDraw = true;
if (SONG == null)
SONG = Song.loadFromJson('tutorial');
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);
#if desktop
storyDifficultyText = '' + CoolUtil.difficultyStuff[storyDifficulty][0];
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
if (isStoryMode)
{
detailsText = "Story Mode: " + WeekData.getCurrentWeek().weekName;
}
else
{
detailsText = "Freeplay";
}
// String for when the game is paused
detailsPausedText = "Paused - " + detailsText;
#end
GameOverSubstate.resetVariables();
var songName:String = Paths.formatToSongPath(SONG.song);
curStage = PlayState.SONG.stage;
trace('stage is: ' + curStage);
if(PlayState.SONG.stage == null || PlayState.SONG.stage.length < 1) {
switch (songName)
{
case 'spookeez' | 'south' | 'monster':
curStage = 'spooky';
case 'pico' | 'blammed' | 'philly' | 'philly-nice':
curStage = 'philly';
case 'milf' | 'satin-panties' | 'high':
curStage = 'limo';
case 'cocoa' | 'eggnog':
curStage = 'mall';
case 'winter-horrorland':
curStage = 'mallEvil';
case 'senpai' | 'roses':
curStage = 'school';
case 'thorns':
curStage = 'schoolEvil';
default:
curStage = 'stage';
}
}
var stageData:StageFile = StageData.getStageFile(curStage);
if(stageData == null) { //Stage couldn't be found, create a dummy stage for preventing a crash
stageData = {
directory: "",
defaultZoom: 0.9,
isPixelStage: false,
boyfriend: [770, 100],
girlfriend: [400, 130],
opponent: [100, 100]
};
}
defaultCamZoom = stageData.defaultZoom;
isPixelStage = stageData.isPixelStage;
BF_X = stageData.boyfriend[0];
BF_Y = stageData.boyfriend[1];
GF_X = stageData.girlfriend[0];
GF_Y = stageData.girlfriend[1];
DAD_X = stageData.opponent[0];
DAD_Y = stageData.opponent[1];
boyfriendGroup = new FlxSpriteGroup(BF_X, BF_Y);
dadGroup = new FlxSpriteGroup(DAD_X, DAD_Y);
gfGroup = new FlxSpriteGroup(GF_X, GF_Y);
switch (curStage)
{
case 'stage': //Week 1
var bg:BGSprite = new BGSprite('stageback', -600, -200, 0.9, 0.9);
add(bg);
var stageFront:BGSprite = new BGSprite('stagefront', -650, 600, 0.9, 0.9);
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
add(stageFront);
if(!ClientPrefs.lowQuality) {
var stageLight:BGSprite = new BGSprite('stage_light', -125, -100, 0.9, 0.9);
stageLight.setGraphicSize(Std.int(stageLight.width * 1.1));
stageLight.updateHitbox();
add(stageLight);
var stageLight:BGSprite = new BGSprite('stage_light', 1225, -100, 0.9, 0.9);
stageLight.setGraphicSize(Std.int(stageLight.width * 1.1));
stageLight.updateHitbox();
stageLight.flipX = true;
add(stageLight);
var stageCurtains:BGSprite = new BGSprite('stagecurtains', -500, -300, 1.3, 1.3);
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
add(stageCurtains);
}
case 'spooky': //Week 2
if(!ClientPrefs.lowQuality) {
halloweenBG = new BGSprite('halloween_bg', -200, -100, ['halloweem bg0', 'halloweem bg lightning strike']);
} else {
halloweenBG = new BGSprite('halloween_bg_low', -200, -100);
}
add(halloweenBG);
halloweenWhite = new BGSprite(null, -FlxG.width, -FlxG.height, 0, 0);
halloweenWhite.makeGraphic(Std.int(FlxG.width * 3), Std.int(FlxG.height * 3), FlxColor.WHITE);
halloweenWhite.alpha = 0;
halloweenWhite.blend = ADD;
//PRECACHE SOUNDS
CoolUtil.precacheSound('thunder_1');
CoolUtil.precacheSound('thunder_2');
case 'philly': //Week 3
if(!ClientPrefs.lowQuality) {
var bg:BGSprite = new BGSprite('philly/sky', -100, 0, 0.1, 0.1);
add(bg);
}
var city:BGSprite = new BGSprite('philly/city', -10, 0, 0.3, 0.3);
city.setGraphicSize(Std.int(city.width * 0.85));
city.updateHitbox();
add(city);
phillyCityLights = new FlxTypedGroup<BGSprite>();
add(phillyCityLights);
for (i in 0...5)
{
var light:BGSprite = new BGSprite('philly/win' + i, city.x, city.y, 0.3, 0.3);
light.visible = false;
light.setGraphicSize(Std.int(light.width * 0.85));
light.updateHitbox();
phillyCityLights.add(light);
}
if(!ClientPrefs.lowQuality) {
var streetBehind:BGSprite = new BGSprite('philly/behindTrain', -40, 50);
add(streetBehind);
}
phillyTrain = new BGSprite('philly/train', 2000, 360);
add(phillyTrain);
trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes'));
CoolUtil.precacheSound('train_passes');
FlxG.sound.list.add(trainSound);
var street:BGSprite = new BGSprite('philly/street', -40, 50);
add(street);
case 'limo': //Week 4
var skyBG:BGSprite = new BGSprite('limo/limoSunset', -120, -50, 0.1, 0.1);
add(skyBG);
if(!ClientPrefs.lowQuality) {
limoMetalPole = new BGSprite('gore/metalPole', -500, 220, 0.4, 0.4);
add(limoMetalPole);
bgLimo = new BGSprite('limo/bgLimo', -150, 480, 0.4, 0.4, ['background limo pink'], true);
add(bgLimo);
limoCorpse = new BGSprite('gore/noooooo', -500, limoMetalPole.y - 130, 0.4, 0.4, ['Henchmen on rail'], true);
add(limoCorpse);
limoCorpseTwo = new BGSprite('gore/noooooo', -500, limoMetalPole.y, 0.4, 0.4, ['henchmen death'], true);
add(limoCorpseTwo);
grpLimoDancers = new FlxTypedGroup<BackgroundDancer>();
add(grpLimoDancers);
for (i in 0...5)
{
var dancer:BackgroundDancer = new BackgroundDancer((370 * i) + 130, bgLimo.y - 400);
dancer.scrollFactor.set(0.4, 0.4);
grpLimoDancers.add(dancer);
}
limoLight = new BGSprite('gore/coldHeartKiller', limoMetalPole.x - 180, limoMetalPole.y - 80, 0.4, 0.4);
add(limoLight);
grpLimoParticles = new FlxTypedGroup<BGSprite>();
add(grpLimoParticles);
//PRECACHE BLOOD
var particle:BGSprite = new BGSprite('gore/stupidBlood', -400, -400, 0.4, 0.4, ['blood'], false);
particle.alpha = 0.01;
grpLimoParticles.add(particle);
resetLimoKill();
//PRECACHE SOUND
CoolUtil.precacheSound('dancerdeath');
}
limo = new BGSprite('limo/limoDrive', -120, 550, 1, 1, ['Limo stage'], true);
fastCar = new BGSprite('limo/fastCarLol', -300, 160);
fastCar.active = true;
limoKillingState = 0;
case 'mall': //Week 5 - Cocoa, Eggnog
var bg:BGSprite = new BGSprite('christmas/bgWalls', -1000, -500, 0.2, 0.2);
bg.setGraphicSize(Std.int(bg.width * 0.8));
bg.updateHitbox();
add(bg);
if(!ClientPrefs.lowQuality) {
upperBoppers = new BGSprite('christmas/upperBop', -240, -90, 0.33, 0.33, ['Upper Crowd Bob']);
upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85));
upperBoppers.updateHitbox();
add(upperBoppers);
var bgEscalator:BGSprite = new BGSprite('christmas/bgEscalator', -1100, -600, 0.3, 0.3);
bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9));
bgEscalator.updateHitbox();
add(bgEscalator);
}
var tree:BGSprite = new BGSprite('christmas/christmasTree', 370, -250, 0.40, 0.40);
add(tree);
bottomBoppers = new BGSprite('christmas/bottomBop', -300, 140, 0.9, 0.9, ['Bottom Level Boppers Idle']);
bottomBoppers.animation.addByPrefix('hey', 'Bottom Level Boppers HEY', 24, false);
bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1));
bottomBoppers.updateHitbox();
add(bottomBoppers);
var fgSnow:BGSprite = new BGSprite('christmas/fgSnow', -600, 700);
add(fgSnow);
santa = new BGSprite('christmas/santa', -840, 150, 1, 1, ['santa idle in fear']);
add(santa);
CoolUtil.precacheSound('Lights_Shut_off');
case 'mallEvil': //Week 5 - Winter Horrorland
var bg:BGSprite = new BGSprite('christmas/evilBG', -400, -500, 0.2, 0.2);
bg.setGraphicSize(Std.int(bg.width * 0.8));
bg.updateHitbox();
add(bg);
var evilTree:BGSprite = new BGSprite('christmas/evilTree', 300, -300, 0.2, 0.2);
add(evilTree);
var evilSnow:BGSprite = new BGSprite('christmas/evilSnow', -200, 700);
add(evilSnow);
case 'school': //Week 6 - Senpai, Roses
GameOverSubstate.deathSoundName = 'fnf_loss_sfx-pixel';
GameOverSubstate.loopSoundName = 'gameOver-pixel';
GameOverSubstate.endSoundName = 'gameOverEnd-pixel';
GameOverSubstate.characterName = 'bf-pixel-dead';
var bgSky:BGSprite = new BGSprite('weeb/weebSky', 0, 0, 0.1, 0.1);
add(bgSky);
bgSky.antialiasing = false;
var repositionShit = -200;
var bgSchool:BGSprite = new BGSprite('weeb/weebSchool', repositionShit, 0, 0.6, 0.90);
add(bgSchool);
bgSchool.antialiasing = false;
var bgStreet:BGSprite = new BGSprite('weeb/weebStreet', repositionShit, 0, 0.95, 0.95);
add(bgStreet);
bgStreet.antialiasing = false;
var widShit = Std.int(bgSky.width * 6);
if(!ClientPrefs.lowQuality) {
var fgTrees:BGSprite = new BGSprite('weeb/weebTreesBack', repositionShit + 170, 130, 0.9, 0.9);
fgTrees.setGraphicSize(Std.int(widShit * 0.8));
fgTrees.updateHitbox();
add(fgTrees);
fgTrees.antialiasing = false;
}
var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800);
bgTrees.frames = Paths.getPackerAtlas('weeb/weebTrees');
bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12);
bgTrees.animation.play('treeLoop');
bgTrees.scrollFactor.set(0.85, 0.85);
add(bgTrees);
bgTrees.antialiasing = false;
if(!ClientPrefs.lowQuality) {
var treeLeaves:BGSprite = new BGSprite('weeb/petals', repositionShit, -40, 0.85, 0.85, ['PETALS ALL'], true);
treeLeaves.setGraphicSize(widShit);
treeLeaves.updateHitbox();
add(treeLeaves);
treeLeaves.antialiasing = false;
}
bgSky.setGraphicSize(widShit);
bgSchool.setGraphicSize(widShit);
bgStreet.setGraphicSize(widShit);
bgTrees.setGraphicSize(Std.int(widShit * 1.4));
bgSky.updateHitbox();
bgSchool.updateHitbox();
bgStreet.updateHitbox();
bgTrees.updateHitbox();
if(!ClientPrefs.lowQuality) {
bgGirls = new BackgroundGirls(-100, 190);
bgGirls.scrollFactor.set(0.9, 0.9);
bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom));
bgGirls.updateHitbox();
add(bgGirls);
}
case 'schoolEvil': //Week 6 - Thorns
GameOverSubstate.deathSoundName = 'fnf_loss_sfx-pixel';
GameOverSubstate.loopSoundName = 'gameOver-pixel';
GameOverSubstate.endSoundName = 'gameOverEnd-pixel';
GameOverSubstate.characterName = 'bf-pixel-dead';
/*if(!ClientPrefs.lowQuality) { //Does this even do something?
var waveEffectBG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 3, 2);
var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2);
}*/
var posX = 400;
var posY = 200;
if(!ClientPrefs.lowQuality) {
var bg:BGSprite = new BGSprite('weeb/animatedEvilSchool', posX, posY, 0.8, 0.9, ['background 2'], true);
bg.scale.set(6, 6);
bg.antialiasing = false;
add(bg);
bgGhouls = new BGSprite('weeb/bgGhouls', -100, 190, 0.9, 0.9, ['BG freaks glitch instance'], false);
bgGhouls.setGraphicSize(Std.int(bgGhouls.width * daPixelZoom));
bgGhouls.updateHitbox();
bgGhouls.visible = false;
bgGhouls.antialiasing = false;
add(bgGhouls);
} else {
var bg:BGSprite = new BGSprite('weeb/animatedEvilSchool_low', posX, posY, 0.8, 0.9);
bg.scale.set(6, 6);
bg.antialiasing = false;
add(bg);
}
}
switch (SONG.song.toLowerCase())
{
case 'snake-eyes':
songfont = "idk.ttf";//it needs to be null
case 'sansational':
songfont = "Axel Gilby Comic Sans.ttf";
case 'last-reel':
songfont = "DK Black Bamboo.ttf";
default:
songfont = "vcr.ttf";
}
if(isPixelStage) {
introSoundsSuffix = '-pixel';
}
add(gfGroup);
// Shitty layering but whatev it works LOL
if (curStage == 'limo')
add(limo);
add(dadGroup);
add(boyfriendGroup);
if(curStage == 'spooky') {
add(halloweenWhite);
}
luaDebugGroup = new FlxTypedGroup<DebugLuaText>();
luaDebugGroup.cameras = [camOther];
add(luaDebugGroup);
var doPush:Bool = false;
var doPush:Bool = false;
var luaFile:String = 'stages/' + curStage + '.lua';
luaFile = Paths.getPreloadPath(luaFile);
if(OpenFlAssets.exists(luaFile)) {
doPush = true;
}
if(curStage == 'philly') {
phillyCityLightsEvent = new FlxTypedGroup<BGSprite>();
for (i in 0...5)
{
var light:BGSprite = new BGSprite('philly/win' + i, -10, 0, 0.3, 0.3);
light.visible = false;
light.setGraphicSize(Std.int(light.width * 0.85));
light.updateHitbox();
phillyCityLightsEvent.add(light);
}
}
if(doPush)
luaArray.push(new FunkinLua(Asset2File.getPath(luaFile)));
if(!modchartSprites.exists('blammedLightsBlack')) { //Creates blammed light black fade in case you didn't make your own
blammedLightsBlack = new ModchartSprite(FlxG.width * -0.5, FlxG.height * -0.5);
blammedLightsBlack.makeGraphic(Std.int(FlxG.width * 2), Std.int(FlxG.height * 2), FlxColor.BLACK);
var position:Int = members.indexOf(gfGroup);
if(members.indexOf(boyfriendGroup) < position) {
position = members.indexOf(boyfriendGroup);
} else if(members.indexOf(dadGroup) < position) {
position = members.indexOf(dadGroup);
}
insert(position, blammedLightsBlack);
blammedLightsBlack.wasAdded = true;
modchartSprites.set('blammedLightsBlack', blammedLightsBlack);
}
if(curStage == 'philly') insert(members.indexOf(blammedLightsBlack) + 1, phillyCityLightsEvent);
blammedLightsBlack = modchartSprites.get('blammedLightsBlack');
blammedLightsBlack.alpha = 0.0;
var gfVersion:String = SONG.player3;
if(gfVersion == null || gfVersion.length < 1) {
switch (curStage)
{
case 'limo':
gfVersion = 'gf-car';
case 'mall' | 'mallEvil':
gfVersion = 'gf-christmas';
case 'school' | 'schoolEvil':
gfVersion = 'gf-pixel';
default:
gfVersion = 'gf';
}
SONG.player3 = gfVersion; //Fix for the Chart Editor
}
gf = new Character(0, 0, gfVersion);
startCharacterPos(gf);
gf.scrollFactor.set(0.95, 0.95);
gfGroup.add(gf);
dad = new Character(0, 0, SONG.player2);
startCharacterPos(dad, true);
dadGroup.add(dad);
boyfriend = new Boyfriend(0, 0, SONG.player1);
startCharacterPos(boyfriend);
boyfriendGroup.add(boyfriend);
var camPos:FlxPoint = new FlxPoint(gf.getGraphicMidpoint().x, gf.getGraphicMidpoint().y);
camPos.x += gf.cameraPosition[0];
camPos.y += gf.cameraPosition[1];
if(dad.curCharacter.startsWith('gf')) {
dad.setPosition(GF_X, GF_Y);
gf.visible = false;
}
switch(curStage)
{
case 'limo':
resetFastCar();
insert(members.indexOf(gfGroup) - 1, fastCar);
case 'schoolEvil':
var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069); //nice
insert(members.indexOf(dadGroup) - 1, evilTrail);
}
var file:String = Paths.json(songName + '/dialogue'); //Checks for json/Psych Engine dialogue
if (OpenFlAssets.exists(file)) {
dialogueJson = DialogueBoxPsych.parseDialogue(file);
}
var file:String = Paths.txt(songName + '/' + songName + 'Dialogue'); //Checks for vanilla/Senpai dialogue
if (OpenFlAssets.exists(file)) {
dialogue = CoolUtil.coolTextFile(file);
}
var doof:DialogueBox = new DialogueBox(false, dialogue);
// doof.x += 70;
// doof.y = FlxG.height * 0.5;
doof.scrollFactor.set();
doof.finishThing = startCountdown;
doof.nextDialogueThing = startNextDialogue;
doof.skipDialogueThing = skipDialogue;
Conductor.songPosition = -5000;
strumLine = new FlxSprite(ClientPrefs.middleScroll ? STRUM_X_MIDDLESCROLL : STRUM_X, 50).makeGraphic(FlxG.width, 10);
if(ClientPrefs.downScroll) strumLine.y = FlxG.height - 150;
strumLine.scrollFactor.set();
timeTxt = new FlxText(STRUM_X + (FlxG.width / 2) - 248, 20, 400, "", 32);
timeTxt.setFormat(Paths.font(songfont), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
timeTxt.scrollFactor.set();
timeTxt.alpha = 0;
timeTxt.borderSize = 2;
timeTxt.visible = !ClientPrefs.hideTime;
if(ClientPrefs.downScroll) timeTxt.y = FlxG.height - 45;
timeBarBG = new AttachedSprite('timeBar');
timeBarBG.x = timeTxt.x;
timeBarBG.y = timeTxt.y + (timeTxt.height / 4);
timeBarBG.scrollFactor.set();
timeBarBG.alpha = 0;
timeBarBG.visible = !ClientPrefs.hideTime;
timeBarBG.color = FlxColor.BLACK;
timeBarBG.xAdd = -4;
timeBarBG.yAdd = -4;
add(timeBarBG);
timeBar = new FlxBar(timeBarBG.x + 4, timeBarBG.y + 4, LEFT_TO_RIGHT, Std.int(timeBarBG.width - 8), Std.int(timeBarBG.height - 8), this,
'songPercent', 0, 1);
timeBar.scrollFactor.set();
timeBar.createFilledBar(0xFF000000, 0xFFFFFFFF);
timeBar.numDivisions = 800; //How much lag this causes?? Should i tone it down to idk, 400 or 200?
timeBar.alpha = 0;
timeBar.visible = !ClientPrefs.hideTime;
add(timeBar);
add(timeTxt);
timeBarBG.sprTracker = timeBar;
strumLineNotes = new FlxTypedGroup<StrumNote>();
add(strumLineNotes);
add(grpNoteSplashes);
var splash:NoteSplash = new NoteSplash(100, 100, 0);
grpNoteSplashes.add(splash);
splash.alpha = 0.0;
opponentStrums = new FlxTypedGroup<StrumNote>();
playerStrums = new FlxTypedGroup<StrumNote>();
// startCountdown();
generateSong(SONG.song);
#if LUA_ALLOWED
for (notetype in noteTypeMap.keys()) {
var luaToLoad:String = 'custom_notetypes/' + notetype + '.lua';
luaToLoad = Paths.getPreloadPath(luaToLoad);
if(OpenFlAssets.exists(luaToLoad)) {
luaArray.push(new FunkinLua(Asset2File.getPath(luaToLoad)));
}
}
for (event in eventPushedMap.keys()) {
var luaToLoad:String = 'custom_events/' + event + '.lua';
luaToLoad = Paths.getPreloadPath(luaToLoad);
if(OpenFlAssets.exists(luaToLoad)) {
luaArray.push(new FunkinLua(Asset2File.getPath(luaToLoad)));
}
}
#end
noteTypeMap.clear();
noteTypeMap = null;
eventPushedMap.clear();
eventPushedMap = null;
// After all characters being loaded, it makes then invisible 0.01s later so that the player won't freeze when you change characters
// add(strumLine);
camFollow = new FlxPoint();
camFollowPos = new FlxObject(0, 0, 1, 1);
snapCamFollowToPos(camPos.x, camPos.y);
if (prevCamFollow != null)
{
camFollow = prevCamFollow;
prevCamFollow = null;
}
if (prevCamFollowPos != null)
{
camFollowPos = prevCamFollowPos;
prevCamFollowPos = null;
}
add(camFollowPos);
FlxG.camera.follow(camFollowPos, LOCKON, 1);
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
FlxG.camera.zoom = defaultCamZoom;
FlxG.camera.focusOn(camFollow);
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
FlxG.fixedTimestep = false;
moveCameraSection(0);
healthBarBG = new AttachedSprite('healthBar');
healthBarBG.y = FlxG.height * 0.89;
healthBarBG.screenCenter(X);
healthBarBG.scrollFactor.set();
healthBarBG.visible = !ClientPrefs.hideHud;
healthBarBG.xAdd = -4;
healthBarBG.yAdd = -4;
add(healthBarBG);
if(ClientPrefs.downScroll) healthBarBG.y = 0.11 * FlxG.height;
healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this,
'health', 0, 2);
healthBar.scrollFactor.set();
// healthBar
healthBar.visible = !ClientPrefs.hideHud;
add(healthBar);
healthBarBG.sprTracker = healthBar;
iconP1 = new HealthIcon(boyfriend.healthIcon, true);
iconP1.y = healthBar.y - (iconP1.height / 2);
iconP1.visible = !ClientPrefs.hideHud;
add(iconP1);
iconP2 = new HealthIcon(dad.healthIcon, false);
iconP2.y = healthBar.y - (iconP2.height / 2);
iconP2.visible = !ClientPrefs.hideHud;
add(iconP2);
reloadHealthBarColors();
scoreTxt = new FlxText(0, healthBarBG.y + 36, FlxG.width, "", 20);
scoreTxt.setFormat(Paths.font(songfont), 20, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
scoreTxt.scrollFactor.set();
scoreTxt.borderSize = 1.25;
scoreTxt.visible = !ClientPrefs.hideHud;
add(scoreTxt);
botplayTxt = new FlxText(400, timeBarBG.y + 55, FlxG.width - 800, "BOTPLAY", 32);
botplayTxt.setFormat(Paths.font(songfont), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
botplayTxt.scrollFactor.set();
botplayTxt.borderSize = 1.25;
botplayTxt.visible = cpuControlled;
add(botplayTxt);
if(ClientPrefs.downScroll) {
botplayTxt.y = timeBarBG.y - 78;
}
var camvignette = new FlxCamera();
FlxG.cameras.add(camvignette);
camvignette.bgColor.alpha = 0;
vignette = new FlxSprite().loadGraphic(Paths.image('stages/bendy/vignette'));
vignette.width = 1280;
vignette.height = 720;
vignette.x = 0;
vignette.y = 0;
vignette.updateHitbox();
add(vignette);
vignette.cameras = [camvignette];
vignette.alpha = 0;
strumLineNotes.cameras = [camHUD];
grpNoteSplashes.cameras = [camHUD];
notes.cameras = [camHUD];
healthBar.cameras = [camHUD];
healthBarBG.cameras = [camHUD];
iconP1.cameras = [camHUD];
iconP2.cameras = [camHUD];
scoreTxt.cameras = [camHUD];
botplayTxt.cameras = [camHUD];
timeBar.cameras = [camHUD];
timeBarBG.cameras = [camHUD];
timeTxt.cameras = [camHUD];
doof.cameras = [camHUD];
if (SONG.song.toLowerCase() == 'snake-eyes')//to run only on this song
{
cupshid = new FlxSprite();
cupshid.frames = Paths.getSparrowAtlas('stages/cup/HUD-effect/CUpheqdshid');
cupshid.animation.addByPrefix('cupshid', 'Cupheadshit_gif instance', 24, false);
cupshid.screenCenter();