2020-10-03 02:50:15 -04:00
package ;
2022-02-09 20:31:36 -05:00
import Note ;
2020-10-24 05:19:13 -04:00
import Section . SwagSection ;
2021-11-29 21:43:38 -05:00
import SongLoad . SwagSong ;
2022-01-20 23:33:51 -05:00
import charting . ChartingState ;
2020-10-25 16:51:06 -04:00
import flixel . FlxCamera ;
2020-10-04 02:42:58 -04:00
import flixel . FlxObject ;
2020-10-03 02:50:15 -04:00
import flixel . FlxSprite ;
import flixel . FlxState ;
2020-10-09 17:24:20 -04:00
import flixel . FlxSubState ;
2021-02-02 00:48:22 -05:00
import flixel . addons . effects . FlxTrail ;
2021-02-02 04:13:28 -05:00
import flixel . addons . transition . FlxTransitionableState ;
2021-04-07 20:19:49 -04:00
import flixel . group . FlxGroup ;
2021-04-18 03:35:43 -04:00
import flixel . math . FlxAngle ;
2020-10-05 05:48:30 -04:00
import flixel . math . FlxMath ;
2020-10-31 21:11:14 -04:00
import flixel . math . FlxPoint ;
2021-01-16 17:21:06 -05:00
import flixel . math . FlxRect ;
2020-10-03 02:50:15 -04:00
import flixel . system . FlxSound ;
import flixel . text . FlxText ;
2020-10-05 14:24:51 -04:00
import flixel . tweens . FlxEase ;
2020-10-03 15:32:15 -04:00
import flixel . tweens . FlxTween ;
2020-10-05 16:32:41 -04:00
import flixel . ui . FlxBar ;
2020-10-04 02:42:58 -04:00
import flixel . util . FlxColor ;
2020-10-05 01:13:12 -04:00
import flixel . util . FlxSort ;
2020-10-03 15:32:15 -04:00
import flixel . util . FlxTimer ;
2020-10-03 02:50:15 -04:00
import haxe . Json ;
2021-08-22 10:37:06 -04:00
import lime . ui . Haptic ;
2020-10-03 02:50:15 -04:00
import lime . utils . Assets ;
2021-04-18 01:43:28 -04:00
import shaderslmfao . BuildingShaders ;
2021-03-21 16:29:47 -04:00
import shaderslmfao . ColorSwap ;
2021-08-27 13:16:31 -04:00
import shaderslmfao . OverlayBlend ;
2022-02-16 16:31:20 -05:00
import ui . PopUpStuff ;
2021-03-26 21:28:04 -04:00
import ui . PreferencesMenu ;
2020-10-03 02:50:15 -04:00
2020-10-04 02:42:58 -04:00
using StringTools ;
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-03-21 16:29:47 -04:00
import Discord . DiscordClient ;
#end
2020-10-09 22:39:52 -04:00
class PlayState extends MusicBeatState
2020-10-03 02:50:15 -04:00
{
2020-12-10 18:23:53 -05:00
public static var curStage: String = ' ' ;
2020-10-24 05:19:13 -04:00
public static var SONG: SwagSong ;
2020-10-31 21:11:14 -04:00
public static var isStoryMode: Bool = false ;
2020-11-06 21:17:27 -05:00
public static var storyWeek: Int = 0 ;
2020-10-31 21:11:14 -04:00
public static var storyPlaylist: Array < String > = [ ] ;
public static var storyDifficulty: Int = 1 ;
2021-03-04 14:30:35 -05:00
public static var deathCounter: Int = 0 ;
2021-03-08 18:38:58 -05:00
public static var practiceMode: Bool = false ;
2021-09-24 11:51:15 -04:00
public static var needsReset: Bool = false ;
2020-10-31 21:11:14 -04:00
var halloweenLevel: Bool = false ;
2020-10-05 18:29:59 -04:00
2021-09-20 11:50:52 -04:00
private var vocals: VoicesGroup ;
2021-04-08 08:17:21 -04:00
private var vocalsFinished: Bool = false ;
2020-10-03 13:36:39 -04:00
2020-10-18 20:59:53 -04:00
private var dad: Character ;
private var gf: Character ;
2020-10-04 14:50:12 -04:00
private var boyfriend: Boyfriend ;
2020-10-03 02:50:15 -04:00
2021-09-24 10:56:05 -04:00
/ * *
* Notes that should be ON SCREEN and have UPDATES running on them !
* /
2020-10-03 02:50:15 -04:00
private var notes: FlxTypedGroup < Note > ;
2021-09-24 10:56:05 -04:00
2020-10-05 05:48:30 -04:00
private var unspawnNotes: Array < Note > = [ ] ;
2020-10-03 02:50:15 -04:00
private var strumLine: FlxSprite ;
2020-10-03 15:32:15 -04:00
2020-10-04 02:42:58 -04:00
private var camFollow: FlxObject ;
2021-02-02 04:13:28 -05:00
private static var prevCamFollow: FlxObject ;
2020-10-04 04:38:21 -04:00
private var strumLineNotes: FlxTypedGroup < FlxSprite > ;
2022-02-16 16:31:20 -05:00
/ * *
* Strumline for p l a y e r
* /
2020-10-04 04:38:21 -04:00
private var playerStrums: FlxTypedGroup < FlxSprite > ;
2020-10-04 02:42:58 -04:00
2020-10-05 05:48:30 -04:00
private var camZooming: Bool = false ;
private var curSong: String = " " ;
2020-10-05 08:55:39 -04:00
private var gfSpeed: Int = 1 ;
private var health: Float = 1 ;
2021-09-24 11:21:34 -04:00
private var healthDisplay: Float = 1 ;
2020-10-05 10:03:38 -04:00
private var combo: Int = 0 ;
2020-10-05 08:55:39 -04:00
2020-10-05 16:32:41 -04:00
private var healthBarBG: FlxSprite ;
private var healthBar: FlxBar ;
2020-10-05 14:24:51 -04:00
private var generatedMusic: Bool = false ;
2020-10-23 19:12:38 -04:00
private var startingSong: Bool = false ;
2020-10-05 14:24:51 -04:00
2020-12-24 18:24:11 -05:00
private var iconP1: HealthIcon ;
private var iconP2: HealthIcon ;
2020-10-26 05:16:05 -04:00
private var camHUD: FlxCamera ;
private var camGame: FlxCamera ;
2020-10-05 16:32:41 -04:00
2021-09-21 15:39:30 -04:00
var dialogue: Array < String > ;
2020-10-31 21:11:14 -04:00
2021-04-09 16:37:54 -04:00
public static var seenCutscene: Bool = false ;
2020-10-31 21:11:14 -04:00
var halloweenBG: FlxSprite ;
2020-11-02 01:46:37 -05:00
var isHalloween: Bool = false ;
2020-10-31 21:11:14 -04:00
2020-12-10 18:23:53 -05:00
var phillyCityLights: FlxTypedGroup < FlxSprite > ;
var phillyTrain: FlxSprite ;
var trainSound: FlxSound ;
2021-03-08 18:38:58 -05:00
var foregroundSprites: FlxTypedGroup < BGSprite > ;
2020-12-26 21:46:22 -05:00
var limo: FlxSprite ;
2020-12-27 03:13:51 -05:00
var grpLimoDancers: FlxTypedGroup < BackgroundDancer > ;
2020-12-27 05:37:04 -05:00
var fastCar: FlxSprite ;
2020-12-26 21:46:22 -05:00
2021-01-19 21:09:47 -05:00
var upperBoppers: FlxSprite ;
var bottomBoppers: FlxSprite ;
2021-01-19 23:29:18 -05:00
var santa: FlxSprite ;
2021-01-19 21:09:47 -05:00
2021-01-25 05:04:31 -05:00
var bgGirls: BackgroundGirls ;
2021-02-02 00:48:22 -05:00
var wiggleShit: WiggleEffect = new WiggleEffect ( ) ;
2021-01-25 04:18:44 -05:00
2021-03-16 01:51:23 -04:00
var tankmanRun: FlxTypedGroup < TankmenBG > ;
2021-04-07 20:19:49 -04:00
var gfCutsceneLayer: FlxGroup ;
2021-04-09 03:03:27 -04:00
var bfTankCutsceneLayer: FlxGroup ;
2021-04-08 21:52:21 -04:00
var tankWatchtower: BGSprite ;
2021-04-18 03:35:43 -04:00
var tankGround: BGSprite ;
2021-03-16 01:51:23 -04:00
2020-10-31 21:11:14 -04:00
var talking: Bool = true ;
2020-11-01 14:16:22 -05:00
var songScore: Int = 0 ;
2020-11-24 22:53:48 -05:00
var scoreTxt: FlxText ;
2020-10-31 21:11:14 -04:00
2021-09-21 15:39:30 -04:00
// Dunno why its called doof lol, it's just the dialogue box
var doof: DialogueBox ;
2021-04-10 01:49:57 -04:00
var grpNoteSplashes: FlxTypedGroup < NoteSplash > ;
2020-11-06 21:17:27 -05:00
public static var campaignScore: Int = 0 ;
2020-12-26 21:46:22 -05:00
var defaultCamZoom: Float = 1.05 ;
2021-01-25 04:18:44 -05:00
// how big to stretch the pixel art assets
public static var daPixelZoom: Float = 6 ;
2021-02-02 02:35:35 -05:00
var inCutscene: Bool = false ;
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 16:59:18 -05:00
// Discord RPC variables
var storyDifficultyText: String = " " ;
var iconRPC: String = " " ;
var songLength: Float = 0 ;
2021-02-27 18:23:50 -05:00
var detailsText: String = " " ;
var detailsPausedText: String = " " ;
2021-02-27 16:59:18 -05:00
#end
2021-04-09 16:37:54 -04:00
var camPos: FlxPoint ;
2021-04-18 01:43:28 -04:00
var lightFadeShader: BuildingShaders ;
2021-04-09 16:37:54 -04:00
2022-02-16 16:31:20 -05:00
var comboPopUps: PopUpStuff ;
2020-10-03 02:50:15 -04:00
override public function create ( )
{
2021-11-23 15:00:10 -05:00
initCameras ( ) ;
2020-10-26 05:16:05 -04:00
2020-10-05 14:24:51 -04:00
persistentUpdate = true ;
persistentDraw = true ;
2020-10-13 04:37:19 -04:00
if ( SONG == null )
2021-11-29 21:43:38 -05:00
SONG = SongLoad . loadFromJson ( ' t u t o r i a l ' ) ;
2020-10-13 04:37:19 -04:00
2021-02-11 17:06:26 -05:00
Conductor . mapBPMChanges ( SONG ) ;
2020-10-30 19:47:19 -04:00
Conductor . changeBPM ( SONG . bpm ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites = new FlxTypedGroup < BGSprite > ( ) ;
2021-11-23 15:00:10 -05:00
// dialogue init shit, just for week 5 really (for now...?)
2020-10-31 21:11:14 -04:00
switch ( SONG . song . toLowerCase ( ) )
{
2021-02-01 01:50:30 -05:00
c ase ' s e n p a i ' :
2021-02-10 15:18:14 -05:00
dialogue = CoolUtil . coolTextFile ( Paths . txt ( ' s e n p a i / s e n p a i D i a l o g u e ' ) ) ;
2021-02-01 05:52:10 -05:00
c ase ' r o s e s ' :
2021-02-10 15:18:14 -05:00
dialogue = CoolUtil . coolTextFile ( Paths . txt ( ' r o s e s / r o s e s D i a l o g u e ' ) ) ;
2021-02-02 04:54:36 -05:00
c ase ' t h o r n s ' :
2021-02-10 15:18:14 -05:00
dialogue = CoolUtil . coolTextFile ( Paths . txt ( ' t h o r n s / t h o r n s D i a l o g u e ' ) ) ;
2020-10-31 21:11:14 -04:00
}
2021-03-31 13:08:55 -04:00
#if discord_rpc
2021-03-18 20:26:17 -04:00
initDiscord ( ) ;
2021-03-31 13:08:55 -04:00
#end
2021-02-26 07:27:32 -05:00
2021-11-23 15:00:10 -05:00
initStageBullshit ( ) ;
initCharacters ( ) ;
add ( foregroundSprites ) ;
if ( dialogue != null )
{
doof = new DialogueBox ( false , dialogue ) ;
doof . scrollFactor . set ( ) ;
doof . finishThing = startCountdown ;
doof . cameras = [ camHUD ] ;
}
Conductor . songPosition = - 5000 ;
strumLine = new FlxSprite ( 0 , 50 ) . makeGraphic ( FlxG . width , 10 ) ;
if ( PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) )
strumLine . y = FlxG . height - 150 ; // 150 just random ass number lol
strumLine . scrollFactor . set ( ) ;
strumLineNotes = new FlxTypedGroup < FlxSprite > ( ) ;
add ( strumLineNotes ) ;
// fake notesplash cache type deal so that it loads in the graphic?
2022-02-16 16:31:20 -05:00
comboPopUps = new PopUpStuff ( ) ;
add ( comboPopUps ) ;
2021-11-23 15:00:10 -05:00
grpNoteSplashes = new FlxTypedGroup < NoteSplash > ( ) ;
var noteSplash: NoteSplash = new NoteSplash ( 100 , 100 , 0 ) ;
grpNoteSplashes . add ( noteSplash ) ;
noteSplash . alpha = 0.1 ;
add ( grpNoteSplashes ) ;
playerStrums = new FlxTypedGroup < FlxSprite > ( ) ;
generateSong ( ) ;
// add(strumLine);
camFollow = new FlxObject ( 0 , 0 , 1 , 1 ) ;
camFollow . setPosition ( camPos . x , camPos . y ) ;
if ( prevCamFollow != null )
{
camFollow = prevCamFollow ;
prevCamFollow = null ;
}
add ( camFollow ) ;
resetCamFollow ( ) ;
FlxG . worldBounds . set ( 0 , 0 , FlxG . width , FlxG . height ) ;
FlxG . fixedTimestep = false ;
healthBarBG = new FlxSprite ( 0 , FlxG . height * 0.9 ) . loadGraphic ( Paths . image ( ' h e a l t h B a r ' ) ) ;
healthBarBG . screenCenter ( X ) ;
healthBarBG . scrollFactor . set ( ) ;
add ( healthBarBG ) ;
if ( PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) )
healthBarBG . y = FlxG . height * 0.1 ;
healthBar = new FlxBar ( healthBarBG . x + 4 , healthBarBG . y + 4 , RIGHT_TO_LEFT , Std . int ( healthBarBG . width - 8 ) , Std . int ( healthBarBG . height - 8 ) , this ,
' h e a l t h D i s p l a y ' , 0 , 2 ) ;
healthBar . scrollFactor . set ( ) ;
healthBar . createFilledBar ( 0xFFFF0000 , 0xFF66FF33 ) ;
// healthBar
add ( healthBar ) ;
scoreTxt = new FlxText ( healthBarBG . x + healthBarBG . width - 190 , healthBarBG . y + 30 , 0 , " " , 20 ) ;
scoreTxt . setFormat ( Paths . font ( " v c r . t t f " ) , 16 , FlxColor . WHITE , RIGHT , FlxTextBorderStyle . OUTLINE , FlxColor . BLACK ) ;
scoreTxt . scrollFactor . set ( ) ;
add ( scoreTxt ) ;
iconP1 = new HealthIcon ( SONG . player1 , true ) ;
iconP1 . y = healthBar . y - ( iconP1 . height / 2 ) ;
add ( iconP1 ) ;
iconP2 = new HealthIcon ( SONG . player2 , false ) ;
iconP2 . y = healthBar . y - ( iconP2 . height / 2 ) ;
add ( iconP2 ) ;
grpNoteSplashes . cameras = [ camHUD ] ;
strumLineNotes . cameras = [ camHUD ] ;
notes . cameras = [ camHUD ] ;
healthBar . cameras = [ camHUD ] ;
healthBarBG . cameras = [ camHUD ] ;
iconP1 . cameras = [ camHUD ] ;
iconP2 . cameras = [ camHUD ] ;
scoreTxt . cameras = [ camHUD ] ;
// if (SONG.song == 'South')
// FlxG.camera.alpha = 0.7;
// UI_camera.zoom = 1;
// cameras = [FlxG.cameras.list[1]];
startingSong = true ;
if ( isStoryMode && ! seenCutscene )
{
seenCutscene = true ;
switch ( curSong . toLowerCase ( ) )
{
c ase " w i n t e r - h o r r o r l a n d " :
var blackScreen: FlxSprite = new FlxSprite ( 0 , 0 ) . makeGraphic ( Std . int ( FlxG . width * 2 ) , Std . int ( FlxG . height * 2 ) , FlxColor . BLACK ) ;
add ( blackScreen ) ;
blackScreen . scrollFactor . set ( ) ;
camHUD . visible = false ;
new FlxTimer ( ) . start ( 0.1 , function ( tmr : FlxTimer )
{
remove ( blackScreen ) ;
FlxG . sound . play ( Paths . sound ( ' L i g h t s _ T u r n _ O n ' ) ) ;
camFollow . y = - 2050 ;
camFollow . x += 200 ;
FlxG . camera . focusOn ( camFollow . getPosition ( ) ) ;
FlxG . camera . zoom = 1.5 ;
new FlxTimer ( ) . start ( 0.8 , function ( tmr : FlxTimer )
{
camHUD . visible = true ;
remove ( blackScreen ) ;
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom } , 2.5 , {
ease : FlxEase . quadInOut ,
onComplete : function ( twn : FlxTween )
{
startCountdown ( ) ;
}
} ) ;
} ) ;
} ) ;
c ase ' s e n p a i ' | ' r o s e s ' | ' t h o r n s ' :
schoolIntro ( doof ) ; // doof is assumed to be non-null, lol!
c ase ' u g h ' :
ughIntro ( ) ;
c ase ' s t r e s s ' :
stressIntro ( ) ;
c ase ' g u n s ' :
gunsIntro ( ) ;
d efault :
startCountdown ( ) ;
}
}
e lse
{
switch ( curSong . toLowerCase ( ) )
{
// REMOVE THIS LATER
// case 'ugh':
// ughIntro();
// case 'stress':
// stressIntro();
// case 'guns':
// gunsIntro();
d efault :
startCountdown ( ) ;
}
}
super . create ( ) ;
}
function initCameras ( )
{
defaultCamZoom = FlxCamera . defaultZoom ;
defaultCamZoom *= 1.05 ;
if ( FlxG . sound . music != null )
FlxG . sound . music . stop ( ) ;
FlxG . sound . cache ( Paths . inst ( PlayState . SONG . song ) ) ;
FlxG . sound . cache ( Paths . voices ( PlayState . SONG . song ) ) ;
// var gameCam:FlxCamera = FlxG.camera;
camGame = new SwagCamera ( ) ;
camHUD = new FlxCamera ( ) ;
camHUD . bgColor . alpha = 0 ;
FlxG . cameras . reset ( camGame ) ;
FlxG . cameras . add ( camHUD , false ) ;
}
2021-11-28 20:26:47 -05:00
// a lot of this stage code will be cleaned up more when the stage load shit is more fleshed out! For now it's still a lot of hardcoded shit!!
2021-11-23 15:00:10 -05:00
function initStageBullshit ( )
{
2021-03-07 15:34:21 -05:00
switch ( SONG . song . toLowerCase ( ) )
2020-10-31 21:11:14 -04:00
{
2021-03-07 01:59:22 -05:00
c ase ' s p o o k e e z ' | ' m o n s t e r ' | ' s o u t h ' :
curStage = " s p o o k y " ;
halloweenLevel = true ;
var hallowTex = Paths . getSparrowAtlas ( ' h a l l o w e e n _ b g ' ) ;
halloweenBG = new FlxSprite ( - 200 , - 100 ) ;
halloweenBG . frames = hallowTex ;
halloweenBG . animation . addByPrefix ( ' i d l e ' , ' h a l l o w e e m b g 0 ' ) ;
halloweenBG . animation . addByPrefix ( ' l i g h t n i n g ' , ' h a l l o w e e m b g l i g h t n i n g s t r i k e ' , 24 , false ) ;
halloweenBG . animation . play ( ' i d l e ' ) ;
halloweenBG . antialiasing = true ;
add ( halloweenBG ) ;
isHalloween = true ;
c ase ' p i c o ' | ' b l a m m e d ' | ' p h i l l y ' :
curStage = ' p h i l l y ' ;
var bg: FlxSprite = new FlxSprite ( - 100 ) . loadGraphic ( Paths . image ( ' p h i l l y / s k y ' ) ) ;
bg . scrollFactor . set ( 0.1 , 0.1 ) ;
add ( bg ) ;
2020-11-02 01:46:37 -05:00
2021-03-07 01:59:22 -05:00
var city: FlxSprite = new FlxSprite ( - 10 ) . loadGraphic ( Paths . image ( ' p h i l l y / c i t y ' ) ) ;
city . scrollFactor . set ( 0.3 , 0.3 ) ;
city . setGraphicSize ( Std . int ( city . width * 0.85 ) ) ;
city . updateHitbox ( ) ;
add ( city ) ;
2020-12-10 18:23:53 -05:00
2021-04-18 01:43:28 -04:00
lightFadeShader = new BuildingShaders ( ) ;
2021-03-07 01:59:22 -05:00
phillyCityLights = new FlxTypedGroup < FlxSprite > ( ) ;
2021-04-18 01:43:28 -04:00
2021-03-07 01:59:22 -05:00
add ( phillyCityLights ) ;
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
for ( i in 0 ... 5 )
{
var light: FlxSprite = new FlxSprite ( city . x ) . loadGraphic ( Paths . image ( ' p h i l l y / w i n ' + i ) ) ;
light . scrollFactor . set ( 0.3 , 0.3 ) ;
light . visible = false ;
light . setGraphicSize ( Std . int ( light . width * 0.85 ) ) ;
light . updateHitbox ( ) ;
light . antialiasing = true ;
2021-04-18 01:43:28 -04:00
light . shader = lightFadeShader . shader ;
2021-03-07 01:59:22 -05:00
phillyCityLights . add ( light ) ;
}
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
var streetBehind: FlxSprite = new FlxSprite ( - 40 , 50 ) . loadGraphic ( Paths . image ( ' p h i l l y / b e h i n d T r a i n ' ) ) ;
add ( streetBehind ) ;
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
phillyTrain = new FlxSprite ( 2000 , 360 ) . loadGraphic ( Paths . image ( ' p h i l l y / t r a i n ' ) ) ;
add ( phillyTrain ) ;
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
trainSound = new FlxSound ( ) . loadEmbedded ( Paths . sound ( ' t r a i n _ p a s s e s ' ) ) ;
FlxG . sound . list . add ( trainSound ) ;
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
// var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png);
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
var street: FlxSprite = new FlxSprite ( - 40 , streetBehind . y ) . loadGraphic ( Paths . image ( ' p h i l l y / s t r e e t ' ) ) ;
add ( street ) ;
c ase " m i l f " | ' s a t i n - p a n t i e s ' | ' h i g h ' :
curStage = ' l i m o ' ;
2021-08-21 20:45:03 -04:00
defaultCamZoom *= 0.90 ;
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
var skyBG: FlxSprite = new FlxSprite ( - 120 , - 50 ) . loadGraphic ( Paths . image ( ' l i m o / l i m o S u n s e t ' ) ) ;
2021-08-27 13:16:31 -04:00
var overlayShader: OverlayBlend = new OverlayBlend ( ) ;
var sunOverlay: FlxSprite = new FlxSprite ( ) . loadGraphic ( Paths . image ( ' l i m o / l i m o O v e r l a y ' ) ) ;
sunOverlay . setGraphicSize ( Std . int ( sunOverlay . width * 2 ) ) ;
sunOverlay . updateHitbox ( ) ;
overlayShader . funnyShit . input = sunOverlay . pixels ;
skyBG . shader = overlayShader ;
2021-03-07 01:59:22 -05:00
skyBG . scrollFactor . set ( 0.1 , 0.1 ) ;
add ( skyBG ) ;
2020-12-10 18:23:53 -05:00
2021-03-07 01:59:22 -05:00
var bgLimo: FlxSprite = new FlxSprite ( - 200 , 480 ) ;
bgLimo . frames = Paths . getSparrowAtlas ( ' l i m o / b g L i m o ' ) ;
bgLimo . animation . addByPrefix ( ' d r i v e ' , " b a c k g r o u n d l i m o p i n k " , 24 ) ;
bgLimo . animation . play ( ' d r i v e ' ) ;
bgLimo . scrollFactor . set ( 0.4 , 0.4 ) ;
add ( bgLimo ) ;
2020-12-26 21:46:22 -05:00
2021-03-07 01:59:22 -05:00
grpLimoDancers = new FlxTypedGroup < BackgroundDancer > ( ) ;
add ( grpLimoDancers ) ;
2020-12-26 21:46:22 -05:00
2021-03-07 01:59:22 -05:00
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 ) ;
}
2020-12-27 03:13:51 -05:00
2021-03-07 01:59:22 -05:00
var overlayShit: FlxSprite = new FlxSprite ( - 500 , - 600 ) . loadGraphic ( Paths . image ( ' l i m o / l i m o O v e r l a y ' ) ) ;
overlayShit . alpha = 0.5 ;
// add(overlayShit);
// var shaderBullshit = new BlendModeEffect(new OverlayShader(), FlxColor.RED);
// FlxG.camera.setFilters([new ShaderFilter(cast shaderBullshit.shader)]);
// overlayShit.shader = shaderBullshit;
2020-12-27 03:13:51 -05:00
2021-03-07 01:59:22 -05:00
limo = new FlxSprite ( - 120 , 550 ) ;
limo . frames = Paths . getSparrowAtlas ( ' l i m o / l i m o D r i v e ' ) ;
limo . animation . addByPrefix ( ' d r i v e ' , " L i m o s t a g e " , 24 ) ;
limo . animation . play ( ' d r i v e ' ) ;
limo . antialiasing = true ;
2020-12-26 21:46:22 -05:00
2021-03-07 01:59:22 -05:00
fastCar = new FlxSprite ( - 300 , 160 ) . loadGraphic ( Paths . image ( ' l i m o / f a s t C a r L o l ' ) ) ;
// add(limo);
c ase " c o c o a " | ' e g g n o g ' :
curStage = ' m a l l ' ;
2020-12-26 21:46:22 -05:00
2021-08-21 20:45:03 -04:00
defaultCamZoom *= 0.80 ;
2020-12-26 21:46:22 -05:00
2021-03-07 01:59:22 -05:00
var bg: FlxSprite = new FlxSprite ( - 1000 , - 500 ) . loadGraphic ( Paths . image ( ' c h r i s t m a s / b g W a l l s ' ) ) ;
bg . antialiasing = true ;
bg . scrollFactor . set ( 0.2 , 0.2 ) ;
bg . active = false ;
bg . setGraphicSize ( Std . int ( bg . width * 0.8 ) ) ;
bg . updateHitbox ( ) ;
add ( bg ) ;
2020-12-26 21:46:22 -05:00
2021-03-07 01:59:22 -05:00
upperBoppers = new FlxSprite ( - 240 , - 90 ) ;
upperBoppers . frames = Paths . getSparrowAtlas ( ' c h r i s t m a s / u p p e r B o p ' ) ;
upperBoppers . animation . addByPrefix ( ' b o p ' , " U p p e r C r o w d B o b " , 24 , false ) ;
upperBoppers . antialiasing = true ;
upperBoppers . scrollFactor . set ( 0.33 , 0.33 ) ;
upperBoppers . setGraphicSize ( Std . int ( upperBoppers . width * 0.85 ) ) ;
upperBoppers . updateHitbox ( ) ;
add ( upperBoppers ) ;
var bgEscalator: FlxSprite = new FlxSprite ( - 1100 , - 600 ) . loadGraphic ( Paths . image ( ' c h r i s t m a s / b g E s c a l a t o r ' ) ) ;
bgEscalator . antialiasing = true ;
bgEscalator . scrollFactor . set ( 0.3 , 0.3 ) ;
bgEscalator . active = false ;
bgEscalator . setGraphicSize ( Std . int ( bgEscalator . width * 0.9 ) ) ;
bgEscalator . updateHitbox ( ) ;
add ( bgEscalator ) ;
var tree: FlxSprite = new FlxSprite ( 370 , - 250 ) . loadGraphic ( Paths . image ( ' c h r i s t m a s / c h r i s t m a s T r e e ' ) ) ;
tree . antialiasing = true ;
tree . scrollFactor . set ( 0.40 , 0.40 ) ;
add ( tree ) ;
bottomBoppers = new FlxSprite ( - 300 , 140 ) ;
bottomBoppers . frames = Paths . getSparrowAtlas ( ' c h r i s t m a s / b o t t o m B o p ' ) ;
bottomBoppers . animation . addByPrefix ( ' b o p ' , ' B o t t o m L e v e l B o p p e r s ' , 24 , false ) ;
bottomBoppers . antialiasing = true ;
bottomBoppers . scrollFactor . set ( 0.9 , 0.9 ) ;
bottomBoppers . setGraphicSize ( Std . int ( bottomBoppers . width * 1 ) ) ;
bottomBoppers . updateHitbox ( ) ;
add ( bottomBoppers ) ;
var fgSnow: FlxSprite = new FlxSprite ( - 600 , 700 ) . loadGraphic ( Paths . image ( ' c h r i s t m a s / f g S n o w ' ) ) ;
fgSnow . active = false ;
fgSnow . antialiasing = true ;
add ( fgSnow ) ;
santa = new FlxSprite ( - 840 , 150 ) ;
santa . frames = Paths . getSparrowAtlas ( ' c h r i s t m a s / s a n t a ' ) ;
santa . animation . addByPrefix ( ' i d l e ' , ' s a n t a i d l e i n f e a r ' , 24 , false ) ;
santa . antialiasing = true ;
add ( santa ) ;
c ase ' w i n t e r - h o r r o r l a n d ' :
2021-08-27 21:56:23 -04:00
loadStage ( ' m a l l E v i l ' ) ;
2021-03-07 01:59:22 -05:00
c ase ' s e n p a i ' | ' r o s e s ' :
curStage = ' s c h o o l ' ;
2021-08-21 20:45:03 -04:00
// defaultCamZoom *= 0.9;
2021-03-07 01:59:22 -05:00
var bgSky = new FlxSprite ( ) . loadGraphic ( Paths . image ( ' w e e b / w e e b S k y ' ) ) ;
bgSky . scrollFactor . set ( 0.1 , 0.1 ) ;
add ( bgSky ) ;
var repositionShit = - 200 ;
var bgSchool: FlxSprite = new FlxSprite ( repositionShit , 0 ) . loadGraphic ( Paths . image ( ' w e e b / w e e b S c h o o l ' ) ) ;
bgSchool . scrollFactor . set ( 0.6 , 0.90 ) ;
add ( bgSchool ) ;
var bgStreet: FlxSprite = new FlxSprite ( repositionShit ) . loadGraphic ( Paths . image ( ' w e e b / w e e b S t r e e t ' ) ) ;
bgStreet . scrollFactor . set ( 0.95 , 0.95 ) ;
add ( bgStreet ) ;
var fgTrees: FlxSprite = new FlxSprite ( repositionShit + 170 , 130 ) . loadGraphic ( Paths . image ( ' w e e b / w e e b T r e e s B a c k ' ) ) ;
fgTrees . scrollFactor . set ( 0.9 , 0.9 ) ;
add ( fgTrees ) ;
var bgTrees: FlxSprite = new FlxSprite ( repositionShit - 380 , - 800 ) ;
var treetex = Paths . getPackerAtlas ( ' w e e b / w e e b T r e e s ' ) ;
bgTrees . frames = treetex ;
bgTrees . animation . add ( ' t r e e L o o p ' , [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 ] , 12 ) ;
bgTrees . animation . play ( ' t r e e L o o p ' ) ;
bgTrees . scrollFactor . set ( 0.85 , 0.85 ) ;
add ( bgTrees ) ;
var treeLeaves: FlxSprite = new FlxSprite ( repositionShit , - 40 ) ;
treeLeaves . frames = Paths . getSparrowAtlas ( ' w e e b / p e t a l s ' ) ;
treeLeaves . animation . addByPrefix ( ' l e a v e s ' , ' P E T A L S A L L ' , 24 , true ) ;
treeLeaves . animation . play ( ' l e a v e s ' ) ;
treeLeaves . scrollFactor . set ( 0.85 , 0.85 ) ;
add ( treeLeaves ) ;
var widShit = Std . int ( bgSky . width * 6 ) ;
bgSky . setGraphicSize ( widShit ) ;
bgSchool . setGraphicSize ( widShit ) ;
bgStreet . setGraphicSize ( widShit ) ;
bgTrees . setGraphicSize ( Std . int ( widShit * 1.4 ) ) ;
fgTrees . setGraphicSize ( Std . int ( widShit * 0.8 ) ) ;
treeLeaves . setGraphicSize ( widShit ) ;
fgTrees . updateHitbox ( ) ;
bgSky . updateHitbox ( ) ;
bgSchool . updateHitbox ( ) ;
bgStreet . updateHitbox ( ) ;
bgTrees . updateHitbox ( ) ;
treeLeaves . updateHitbox ( ) ;
bgGirls = new BackgroundGirls ( - 100 , 190 ) ;
bgGirls . scrollFactor . set ( 0.9 , 0.9 ) ;
if ( SONG . song . toLowerCase ( ) == ' r o s e s ' )
{
bgGirls . getScared ( ) ;
}
2020-12-27 05:37:04 -05:00
2021-03-07 01:59:22 -05:00
bgGirls . setGraphicSize ( Std . int ( bgGirls . width * daPixelZoom ) ) ;
bgGirls . updateHitbox ( ) ;
add ( bgGirls ) ;
c ase ' t h o r n s ' :
2021-09-08 20:01:55 -04:00
// loadStage('schoolEvil');
curStage = ' s c h o o l E v i l ' ;
var schoolBG: FlxSprite = new FlxSprite ( - 200 , 0 ) . loadGraphic ( Paths . image ( ' w e e b / e v i l S c h o o l B G ' ) ) ;
2021-09-08 20:09:30 -04:00
wiggleShit . waveAmplitude = 0.017 ;
2021-09-08 20:01:55 -04:00
wiggleShit . waveSpeed = 2 ;
wiggleShit . waveFrequency = 4 ;
schoolBG . shader = wiggleShit . shader ;
schoolBG . setGraphicSize ( Std . int ( schoolBG . width * 6 ) ) ;
schoolBG . updateHitbox ( ) ;
// schoolBG.scale.set(6, 6);
add ( schoolBG ) ;
schoolBG . scrollFactor . set ( 0.7 , 1 ) ;
var schoolFront: FlxSprite = new FlxSprite ( - 250 , schoolBG . y + 20 ) . loadGraphic ( Paths . image ( ' w e e b / e v i l S c h o o l F G ' ) ) ;
schoolFront . shader = wiggleShit . shader ;
schoolFront . setGraphicSize ( Std . int ( schoolFront . width * 6 ) ) ;
schoolFront . updateHitbox ( ) ;
add ( schoolFront ) ;
2021-03-07 01:59:22 -05:00
2021-03-07 15:34:21 -05:00
c ase ' g u n s ' | ' s t r e s s ' | ' u g h ' :
2021-08-27 21:56:23 -04:00
loadStage ( ' t a n k ' ) ;
2021-03-07 15:34:21 -05:00
2021-08-27 21:56:23 -04:00
// this goes after tankSky and before tankMountains in stage file
// need to accomodate for the velocity thing!
2021-04-01 21:35:10 -04:00
var tankSky: BGSprite = new BGSprite ( ' t a n k C l o u d s ' , FlxG . random . int ( - 700 , - 100 ) , FlxG . random . int ( - 20 , 20 ) , 0.1 , 0.1 ) ;
tankSky . active = true ;
tankSky . velocity . x = FlxG . random . float ( 5 , 15 ) ;
2021-03-07 15:34:21 -05:00
add ( tankSky ) ;
2021-04-08 21:52:21 -04:00
tankWatchtower = new BGSprite ( ' t a n k W a t c h t o w e r ' , 100 , 50 , 0.5 , 0.5 , [ ' w a t c h t o w e r g r a d i e n t c o l o r ' ] ) ;
2021-03-07 15:34:21 -05:00
add ( tankWatchtower ) ;
2021-04-18 03:35:43 -04:00
tankGround = new BGSprite ( ' t a n k R o l l i n g ' , 300 , 300 , 0.5 , 0.5 , [ ' B G t a n k w l i g h t i n g ' ] , true ) ;
add ( tankGround ) ;
2021-04-18 13:23:09 -04:00
// tankGround.active = false;
2021-04-18 03:35:43 -04:00
2021-04-09 22:49:25 -04:00
tankmanRun = new FlxTypedGroup < TankmenBG > ( ) ;
add ( tankmanRun ) ;
2021-04-01 21:35:10 -04:00
var tankGround: BGSprite = new BGSprite ( ' t a n k G r o u n d ' , - 420 , - 150 ) ;
tankGround . setGraphicSize ( Std . int ( tankGround . width * 1.15 ) ) ;
2021-04-01 19:39:03 -04:00
tankGround . updateHitbox ( ) ;
2021-03-07 15:34:21 -05:00
add ( tankGround ) ;
2021-04-18 03:35:43 -04:00
moveTank ( ) ;
2021-03-31 15:41:45 -04:00
// smokeLeft.screenCenter();
2021-04-01 19:39:03 -04:00
var fgTank0: BGSprite = new BGSprite ( ' t a n k 0 ' , - 500 , 650 , 1.7 , 1.5 , [ ' f g ' ] ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites . add ( fgTank0 ) ;
2021-04-18 05:25:44 -04:00
var fgTank1: BGSprite = new BGSprite ( ' t a n k 1 ' , - 300 , 750 , 2 , 0.2 , [ ' f g ' ] ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites . add ( fgTank1 ) ;
// just called 'foreground' just cuz small inconsistency no bbiggei
2021-04-01 19:39:03 -04:00
var fgTank2: BGSprite = new BGSprite ( ' t a n k 2 ' , 450 , 940 , 1.5 , 1.5 , [ ' f o r e g r o u n d ' ] ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites . add ( fgTank2 ) ;
2021-04-18 17:28:10 -04:00
var fgTank4: BGSprite = new BGSprite ( ' t a n k 4 ' , 1300 , 900 , 1.5 , 1.5 , [ ' f g ' ] ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites . add ( fgTank4 ) ;
2021-04-18 17:28:10 -04:00
var fgTank5: BGSprite = new BGSprite ( ' t a n k 5 ' , 1620 , 700 , 1.5 , 1.5 , [ ' f g ' ] ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites . add ( fgTank5 ) ;
2021-04-18 17:28:10 -04:00
var fgTank3: BGSprite = new BGSprite ( ' t a n k 3 ' , 1300 , 1200 , 3.5 , 2.5 , [ ' f g ' ] ) ;
2021-03-08 18:38:58 -05:00
foregroundSprites . add ( fgTank3 ) ;
2021-09-10 10:07:55 -04:00
c ase " d a r n e l l " :
2021-09-06 14:50:04 -04:00
loadStage ( ' p h i l l y S t r e e t s ' ) ;
2021-03-07 01:59:22 -05:00
d efault :
2021-08-27 18:08:01 -04:00
loadStage ( ' s t a g e ' ) ;
2020-10-31 21:11:14 -04:00
}
2021-11-23 15:00:10 -05:00
}
2020-10-05 16:55:48 -04:00
2021-11-23 15:00:10 -05:00
function initCharacters ( )
{
2021-09-14 17:12:11 -04:00
// all dis is shitty, redo later for stage shit
2021-01-14 23:33:12 -05:00
var gfVersion: String = ' g f ' ;
2021-01-19 21:09:47 -05:00
switch ( curStage )
{
c ase ' l i m o ' :
gfVersion = ' g f - c a r ' ;
2021-02-12 01:20:20 -05:00
c ase ' m a l l ' | ' m a l l E v i l ' :
2021-01-20 04:03:49 -05:00
gfVersion = ' g f - c h r i s t m a s ' ;
2021-04-21 22:17:00 -04:00
c ase ' s c h o o l ' | ' s c h o o l E v i l ' :
2021-02-02 00:48:22 -05:00
gfVersion = ' g f - p i x e l ' ;
2021-04-09 22:49:25 -04:00
c ase ' t a n k ' :
gfVersion = ' g f - t a n k m e n ' ;
2021-01-19 21:09:47 -05:00
}
2021-09-14 17:12:11 -04:00
if ( SONG . player1 == " p i c o " )
{
gfVersion = " n e n e " ;
}
2021-03-13 20:53:57 -05:00
if ( SONG . song . toLowerCase ( ) == ' s t r e s s ' )
gfVersion = ' p i c o - s p e a k e r ' ;
2021-01-14 23:33:12 -05:00
gf = new Character ( 400 , 130 , gfVersion ) ;
2020-10-05 07:46:57 -04:00
gf . scrollFactor . set ( 0.95 , 0.95 ) ;
2021-03-13 20:53:57 -05:00
switch ( gfVersion )
{
c ase ' p i c o - s p e a k e r ' :
gf . x -= 50 ;
gf . y -= 200 ;
2021-03-30 16:58:05 -04:00
2021-04-18 16:54:21 -04:00
var tempTankman: TankmenBG = new TankmenBG ( 20 , 500 , true ) ;
tempTankman . strumTime = 10 ;
tempTankman . resetShit ( 20 , 600 , true ) ;
tankmanRun . add ( tempTankman ) ;
2021-03-30 16:58:05 -04:00
for ( i in 0 ... TankmenBG . animationNotes . length )
{
2021-04-09 22:49:25 -04:00
if ( FlxG . random . bool ( 16 ) )
2021-04-01 21:35:10 -04:00
{
2021-04-10 01:49:57 -04:00
var tankman: TankmenBG = tankmanRun . recycle ( TankmenBG ) ;
// new TankmenBG(500, 200 + FlxG.random.int(50, 100), TankmenBG.animationNotes[i][1] < 2);
2021-04-01 21:35:10 -04:00
tankman . strumTime = TankmenBG . animationNotes [ i ] [ 0 ] ;
2021-04-10 01:49:57 -04:00
tankman . resetShit ( 500 , 200 + FlxG . random . int ( 50 , 100 ) , TankmenBG . animationNotes [ i ] [ 1 ] < 2 ) ;
2021-04-01 21:35:10 -04:00
tankmanRun . add ( tankman ) ;
}
2021-03-30 16:58:05 -04:00
}
2021-03-13 20:53:57 -05:00
}
2020-10-18 20:59:53 -04:00
dad = new Character ( 100 , 100 , SONG . player2 ) ;
2020-10-03 02:50:15 -04:00
2021-04-09 16:37:54 -04:00
camPos = new FlxPoint ( dad . getGraphicMidpoint ( ) . x , dad . getGraphicMidpoint ( ) . y ) ;
2020-10-31 21:11:14 -04:00
2020-10-23 19:12:38 -04:00
switch ( SONG . player2 )
2020-10-18 20:59:53 -04:00
{
2020-10-23 19:12:38 -04:00
c ase ' g f ' :
dad . setPosition ( gf . x , gf . y ) ;
gf . visible = false ;
2020-10-31 21:11:14 -04:00
if ( isStoryMode )
{
camPos . x += 600 ;
tweenCamIn ( ) ;
}
2020-10-23 19:12:38 -04:00
c ase " s p o o k y " :
dad . y += 200 ;
2020-10-30 19:47:19 -04:00
c ase " m o n s t e r " :
dad . y += 100 ;
2021-01-20 01:38:39 -05:00
c ase ' m o n s t e r - c h r i s t m a s ' :
dad . y += 130 ;
2020-10-31 21:11:14 -04:00
c ase ' d a d ' :
camPos . x += 400 ;
2020-12-09 17:46:47 -05:00
c ase ' p i c o ' :
2020-12-10 18:23:53 -05:00
camPos . x += 600 ;
2020-12-09 17:46:47 -05:00
dad . y += 300 ;
2021-01-19 21:09:47 -05:00
c ase ' p a r e n t s - c h r i s t m a s ' :
dad . x -= 500 ;
2021-04-21 22:17:00 -04:00
c ase ' s e n p a i ' | ' s e n p a i - a n g r y ' :
2021-02-02 03:24:34 -05:00
dad . x += 150 ;
dad . y += 360 ;
camPos . set ( dad . getGraphicMidpoint ( ) . x + 300 , dad . getGraphicMidpoint ( ) . y ) ;
2021-02-02 00:48:22 -05:00
c ase ' s p i r i t ' :
dad . x -= 150 ;
dad . y += 100 ;
camPos . set ( dad . getGraphicMidpoint ( ) . x + 300 , dad . getGraphicMidpoint ( ) . y ) ;
2021-03-04 14:30:35 -05:00
c ase ' t a n k m a n ' :
dad . y += 180 ;
2020-10-18 20:59:53 -04:00
}
2021-01-13 22:38:31 -05:00
boyfriend = new Boyfriend ( 770 , 450 , SONG . player1 ) ;
2020-10-03 02:50:15 -04:00
2020-12-26 21:46:22 -05:00
// REPOSITIONING PER STAGE
switch ( curStage )
{
c ase ' l i m o ' :
2021-01-20 05:31:43 -05:00
boyfriend . y -= 220 ;
boyfriend . x += 260 ;
resetFastCar ( ) ;
add ( fastCar ) ;
2021-01-19 22:58:07 -05:00
c ase ' m a l l ' :
2021-01-20 05:31:43 -05:00
boyfriend . x += 200 ;
c ase ' m a l l E v i l ' :
boyfriend . x += 320 ;
dad . y -= 80 ;
2021-01-24 22:42:51 -05:00
c ase ' s c h o o l ' :
2021-02-02 00:48:22 -05:00
boyfriend . x += 200 ;
boyfriend . y += 220 ;
gf . x += 180 ;
gf . y += 300 ;
c ase ' s c h o o l E v i l ' :
// trailArea.scrollFactor.set();
var evilTrail = new FlxTrail ( dad , null , 4 , 24 , 0.3 , 0.069 ) ;
// evilTrail.changeValuesEnabled(false, false, false, false);
// evilTrail.changeGraphic()
add ( evilTrail ) ;
// evilTrail.scrollFactor.set(1.1, 1.1);
2021-01-31 09:17:56 -05:00
boyfriend . x += 200 ;
boyfriend . y += 220 ;
gf . x += 180 ;
gf . y += 300 ;
2021-04-01 19:39:03 -04:00
c ase " t a n k " :
2021-04-10 01:49:57 -04:00
gf . y += 10 ;
gf . x -= 30 ;
2021-04-01 21:35:10 -04:00
boyfriend . x += 40 ;
boyfriend . y += 0 ;
dad . y += 60 ;
2021-04-01 19:39:03 -04:00
dad . x -= 80 ;
2021-04-01 21:43:53 -04:00
2021-04-10 01:49:57 -04:00
if ( gfVersion != ' p i c o - s p e a k e r ' )
2021-04-01 21:43:53 -04:00
{
2021-04-10 01:49:57 -04:00
gf . x -= 170 ;
gf . y -= 75 ;
2021-04-01 21:43:53 -04:00
}
2021-09-06 14:50:04 -04:00
c ase ' s t a g e ' | ' p h i l l y S t r e e t s ' :
2021-09-02 18:39:40 -04:00
dad . y = 870 - dad . height ;
2020-12-26 21:46:22 -05:00
}
2021-02-02 00:48:22 -05:00
add ( gf ) ;
2021-02-14 03:32:24 -05:00
2021-04-07 20:19:49 -04:00
gfCutsceneLayer = new FlxGroup ( ) ;
add ( gfCutsceneLayer ) ;
2021-04-09 03:03:27 -04:00
bfTankCutsceneLayer = new FlxGroup ( ) ;
add ( bfTankCutsceneLayer ) ;
2021-02-14 03:32:24 -05:00
// Shitty layering but whatev it works LOL
if ( curStage == ' l i m o ' )
add ( limo ) ;
2021-02-02 00:48:22 -05:00
add ( dad ) ;
add ( boyfriend ) ;
2020-10-23 19:12:38 -04:00
}
2021-04-07 20:19:49 -04:00
function ughIntro ( )
{
2021-04-11 18:53:37 -04:00
inCutscene = true ;
2021-04-18 06:53:23 -04:00
2021-04-19 02:46:02 -04:00
var blackShit: FlxSprite = new FlxSprite ( - 200 , - 200 ) . makeGraphic ( FlxG . width * 2 , FlxG . height * 2 , FlxColor . BLACK ) ;
blackShit . scrollFactor . set ( ) ;
add ( blackShit ) ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
var vid: FlxVideo = new FlxVideo ( ' m u s i c / u g h C u t s c e n e . m p 4 ' ) ;
vid . finishCallback = function ( )
{
remove ( blackShit ) ;
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom } , ( Conductor . crochet / 1000 ) * 5 , { ease : FlxEase . quadInOut } ) ;
startCountdown ( ) ;
cameraMovement ( ) ;
} ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
FlxG . camera . zoom = defaultCamZoom * 1.2 ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
camFollow . x += 100 ;
camFollow . y += 100 ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
/ *
FlxG . sound . playMusic ( Paths . music ( ' D I S T O R T O ' ) , 0 ) ;
FlxG . sound . music . fadeIn ( 5 , 0 , 0.5 ) ;
2021-04-17 23:19:33 -04:00
2021-04-19 02:46:02 -04:00
dad . visible = false ;
var tankCutscene: TankCutscene = new TankCutscene ( - 20 , 320 ) ;
tankCutscene . frames = Paths . getSparrowAtlas ( ' c u t s c e n e S t u f f / t a n k T a l k S o n g 1 ' ) ;
tankCutscene . animation . addByPrefix ( ' w e l l W e l l ' , ' T A N K T A L K 1 P 1 ' , 24 , false ) ;
tankCutscene . animation . addByPrefix ( ' k i l l Y o u ' , ' T A N K T A L K 1 P 2 ' , 24 , false ) ;
tankCutscene . animation . play ( ' w e l l W e l l ' ) ;
tankCutscene . antialiasing = true ;
gfCutsceneLayer . add ( tankCutscene ) ;
2021-04-17 23:19:33 -04:00
2021-04-19 02:46:02 -04:00
camHUD . visible = false ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
FlxG . camera . zoom *= 1.2 ;
2021-04-18 16:54:21 -04:00
camFollow . y += 100 ;
2021-04-17 23:19:33 -04:00
2021-04-19 02:46:02 -04:00
tankCutscene . startSyncAudio = FlxG . sound . load ( Paths . sound ( ' w e l l W e l l W e l l ' ) ) ;
new FlxTimer ( ) . start ( 3 , function ( tmr : FlxTimer )
2021-04-07 20:19:49 -04:00
{
2021-04-19 02:46:02 -04:00
camFollow . x += 800 ;
camFollow . y += 100 ;
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom * 1.2 } , 0.27 , { ease : FlxEase . quadInOut } ) ;
new FlxTimer ( ) . start ( 1.5 , function ( bep : FlxTimer )
2021-04-17 23:19:33 -04:00
{
2021-04-19 02:46:02 -04:00
boyfriend . playAnim ( ' s i n g U P ' ) ;
// play sound
FlxG . sound . play ( Paths . sound ( ' b f B e e p ' ) , function ( )
{
boyfriend . playAnim ( ' i d l e ' ) ;
} ) ;
2021-04-11 18:53:37 -04:00
} ) ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
new FlxTimer ( ) . start ( 3 , function ( swaggy : FlxTimer )
2021-04-07 20:19:49 -04:00
{
2021-04-19 02:46:02 -04:00
camFollow . x -= 800 ;
camFollow . y -= 100 ;
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom * 1.2 } , 0.5 , { ease : FlxEase . quadInOut } ) ;
tankCutscene . animation . play ( ' k i l l Y o u ' ) ;
FlxG . sound . play ( Paths . sound ( ' k i l l Y o u ' ) ) ;
new FlxTimer ( ) . start ( 6.1 , function ( swagasdga : FlxTimer )
{
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom } , ( Conductor . crochet / 1000 ) * 5 , { ease : FlxEase . quadInOut } ) ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
FlxG . sound . music . fadeOut ( ( Conductor . crochet / 1000 ) * 5 , 0 ) ;
2021-04-08 17:31:08 -04:00
2021-04-19 02:46:02 -04:00
new FlxTimer ( ) . start ( ( Conductor . crochet / 1000 ) * 5 , function ( money : FlxTimer )
{
dad . visible = true ;
gfCutsceneLayer . remove ( tankCutscene ) ;
} ) ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
cameraMovement ( ) ;
2021-04-07 20:19:49 -04:00
2021-04-19 02:46:02 -04:00
startCountdown ( ) ;
camHUD . visible = true ;
} ) ;
2021-04-07 20:19:49 -04:00
} ) ;
2021-04-19 02:46:02 -04:00
} ) ; * /
2021-04-07 20:19:49 -04:00
}
2021-08-27 18:08:01 -04:00
function loadStage ( path : String )
{
curStage = path ;
2021-08-27 21:56:23 -04:00
var json = Assets . getText ( Paths . file ( ' d a t a / s t a g e d a t a / ' + curStage + ' S t a g e . j s o n ' ) ) ;
2021-08-27 18:08:01 -04:00
var parsed: StageData = cast Json . parse ( json ) ;
defaultCamZoom *= parsed . camZoom ;
for ( prop in parsed . propsBackground )
{
2021-08-28 12:41:15 -04:00
var funnyProp: BGSprite = new BGSprite ( prop . path , prop . x , prop . y , prop . scrollX , prop . scrollY , null , false , false ) ;
if ( prop . animBullshit != null )
funnyProp . setupSparrow ( prop . path , prop . animBullshit . anims , prop . animBullshit . isLooping ) ;
e lse
funnyProp . justLoadImage ( prop . path ) ;
2021-08-27 18:08:01 -04:00
2021-08-28 13:01:17 -04:00
if ( prop . updateHitbox != null && ! prop . updateHitbox )
{
funnyProp . scale . set ( prop . scaleX , prop . scaleY ) ;
}
e lse
{
funnyProp . setGraphicSize ( Std . int ( funnyProp . width * prop . scaleX ) , Std . int ( funnyProp . height * prop . scaleY ) ) ;
funnyProp . updateHitbox ( ) ;
}
if ( prop . antialiasing != null )
funnyProp . antialiasing = prop . antialiasing ;
2021-08-27 18:08:01 -04:00
funnyProp . scrollFactor . set ( prop . scrollX , prop . scrollY ) ;
add ( funnyProp ) ;
}
trace ( parsed . propsBackground ) ;
}
2021-04-08 12:33:19 -04:00
function gunsIntro ( )
{
2021-04-11 18:53:37 -04:00
inCutscene = true ;
2021-04-18 06:53:23 -04:00
var blackShit: FlxSprite = new FlxSprite ( - 200 , - 200 ) . makeGraphic ( FlxG . width * 2 , FlxG . height * 2 , FlxColor . BLACK ) ;
blackShit . scrollFactor . set ( ) ;
add ( blackShit ) ;
2021-04-18 04:09:56 -04:00
var vid: FlxVideo = new FlxVideo ( ' m u s i c / g u n s C u t s c e n e . m p 4 ' ) ;
vid . finishCallback = function ( )
{
2021-04-18 06:53:23 -04:00
remove ( blackShit ) ;
2021-04-18 04:09:56 -04:00
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom } , ( Conductor . crochet / 1000 ) * 5 , { ease : FlxEase . quadInOut } ) ;
startCountdown ( ) ;
cameraMovement ( ) ;
} ;
2021-04-09 16:37:54 -04:00
2021-04-18 13:23:09 -04:00
/ * camFollow . setPosition ( camPos . x , camPos . y ) ;
2021-04-08 17:31:08 -04:00
2021-04-18 04:09:56 -04:00
camHUD . visible = false ;
2021-04-08 17:31:08 -04:00
2021-04-18 04:09:56 -04:00
FlxG . sound . playMusic ( Paths . music ( ' D I S T O R T O ' ) , 0 ) ;
FlxG . sound . music . fadeIn ( 5 , 0 , 0.5 ) ;
2021-04-08 12:33:19 -04:00
2021-04-18 04:09:56 -04:00
camFollow . y += 100 ;
2021-04-08 12:33:19 -04:00
2021-04-18 04:09:56 -04:00
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom * 1.3 } , 4 , { ease : FlxEase . quadInOut } ) ;
2021-04-08 12:33:19 -04:00
2021-04-18 04:09:56 -04:00
dad . visible = false ;
var tankCutscene: TankCutscene = new TankCutscene ( 20 , 320 ) ;
tankCutscene . frames = Paths . getSparrowAtlas ( ' c u t s c e n e S t u f f / t a n k T a l k S o n g 2 ' ) ;
tankCutscene . animation . addByPrefix ( ' t a n k y g u y ' , ' T A N K T A L K 2 ' , 24 , false ) ;
tankCutscene . animation . play ( ' t a n k y g u y ' ) ;
tankCutscene . antialiasing = true ;
gfCutsceneLayer . add ( tankCutscene ) ; // add();
2021-04-08 12:33:19 -04:00
2021-04-18 04:09:56 -04:00
tankCutscene . startSyncAudio = FlxG . sound . load ( Paths . sound ( ' t a n k S o n g 2 ' ) ) ;
2021-04-08 17:31:08 -04:00
2021-04-18 04:09:56 -04:00
new FlxTimer ( ) . start ( 4.1 , function ( ugly : FlxTimer )
{
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom * 1.4 } , 0.4 , { ease : FlxEase . quadOut } ) ;
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom * 1.3 } , 0.7 , { ease : FlxEase . quadInOut , startDelay : 0.45 } ) ;
2021-04-08 12:33:19 -04:00
2021-04-18 04:09:56 -04:00
gf . playAnim ( ' s a d ' ) ;
} ) ;
2021-04-08 17:31:08 -04:00
2021-04-18 04:09:56 -04:00
new FlxTimer ( ) . start ( 11 , function ( tmr : FlxTimer )
2021-04-08 12:33:19 -04:00
{
2021-04-18 04:09:56 -04:00
FlxG . sound . music . fadeOut ( ( Conductor . crochet / 1000 ) * 5 , 0 ) ;
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom } , ( Conductor . crochet * 5 ) / 1000 , { ease : FlxEase . quartIn } ) ;
startCountdown ( ) ;
new FlxTimer ( ) . start ( ( Conductor . crochet * 25 ) / 1000 , function ( daTim : FlxTimer )
{
dad . visible = true ;
gfCutsceneLayer . remove ( tankCutscene ) ;
} ) ;
2021-04-08 17:31:08 -04:00
2021-04-18 04:09:56 -04:00
camHUD . visible = true ;
} ) ; * /
2021-04-08 12:33:19 -04:00
}
2021-04-09 20:34:25 -04:00
/ * *
* [
* [ 0 , function ( ) { blah ; } ] ,
* [ 4.6 , function ( ) { blah ; } ] ,
* [ 25.1 , function ( ) { blah ; } ] ,
* [ 30.7 , function ( ) { blah ; } ]
* ]
* SOMETHING LIKE THIS
* /
// var cutsceneFunctions:Array<Dynamic> = [];
2021-04-07 20:19:49 -04:00
function stressIntro ( )
{
2021-04-11 18:53:37 -04:00
inCutscene = true ;
2021-04-18 06:53:23 -04:00
var blackShit: FlxSprite = new FlxSprite ( - 200 , - 200 ) . makeGraphic ( FlxG . width * 2 , FlxG . height * 2 , FlxColor . BLACK ) ;
blackShit . scrollFactor . set ( ) ;
add ( blackShit ) ;
2021-04-18 05:25:44 -04:00
var vid: FlxVideo = new FlxVideo ( ' m u s i c / s t r e s s C u t s c e n e . m p 4 ' ) ;
vid . finishCallback = function ( )
{
2021-04-18 06:53:23 -04:00
remove ( blackShit ) ;
2021-04-18 05:25:44 -04:00
FlxTween . tween ( FlxG . camera , { zoom : defaultCamZoom } , ( Conductor . crochet / 1000 ) * 5 , { ease : FlxEase . quadInOut } ) ;
startCountdown ( ) ;
cameraMovement ( ) ;
} ;
2021-04-10 01:49:57 -04:00
2021-04-18 13:23:09 -04:00
/ * camHUD . visible = false ;
2021-04-18 05:25:44 -04:00
// for story mode shit
camFollow . setPosition ( camPos . x , camPos . y ) ;
var dummyLoaderShit: FlxGroup = new FlxGroup ( ) ;
add ( dummyLoaderShit ) ;
2021-04-11 19:08:36 -04:00
for ( i in 0 ... 7 )
{
var dummyLoader: FlxSprite = new FlxSprite ( ) ;
dummyLoader . loadGraphic ( Paths . image ( ' c u t s c e n e S t u f f / g f H o l d u p - ' + i ) ) ;
dummyLoaderShit . add ( dummyLoader ) ;
dummyLoader . alpha = 0.01 ;
dummyLoader . y = FlxG . height - 20 ;
// dummyLoader.drawFrame(true);
}
2021-04-10 01:49:57 -04:00
2021-04-18 05:25:44 -04:00
dad . visible = false ;
2021-04-08 18:59:37 -04:00
2021-04-18 05:25:44 -04:00
// gf.y += 300;
gf . alpha = 0.01 ;
2021-04-08 20:48:11 -04:00
2021-04-18 05:25:44 -04:00
var gfTankmen: FlxSprite = new FlxSprite ( 210 , 70 ) ;
gfTankmen . frames = Paths . getSparrowAtlas ( ' c h a r a c t e r s / g f T a n k m e n ' ) ;
gfTankmen . animation . addByPrefix ( ' l o o p ' , ' G F D a n c i n g a t G u n p o i n t ' , 24 , true ) ;
gfTankmen . animation . play ( ' l o o p ' ) ;
gfTankmen . antialiasing = true ;
gfCutsceneLayer . add ( gfTankmen ) ;
2021-04-08 20:48:11 -04:00
2021-04-18 05:25:44 -04:00
var tankCutscene: TankCutscene = new TankCutscene ( - 70 , 320 ) ;
tankCutscene . frames = Paths . getSparrowAtlas ( ' c u t s c e n e S t u f f / t a n k T a l k S o n g 3 - p t 1 ' ) ;
tankCutscene . animation . addByPrefix ( ' t a n k y g u y ' , ' T A N K T A L K 3 P 1 U N C U T ' , 24 , false ) ;
// tankCutscene.animation.addByPrefix('weed', 'sexAmbig', 24, false);
tankCutscene . animation . play ( ' t a n k y g u y ' ) ;
2021-04-09 20:34:25 -04:00
2021-04-18 05:25:44 -04:00
tankCutscene . antialiasing = true ;
bfTankCutsceneLayer . add ( tankCutscene ) ; // add();
2021-04-08 18:59:37 -04:00
2021-04-18 05:25:44 -04:00
var alsoTankCutscene: FlxSprite = new FlxSprite ( 20 , 320 ) ;
alsoTankCutscene . frames = Paths . getSparrowAtlas ( ' c u t s c e n e S t u f f / t a n k T a l k S o n g 3 - p t 2 ' ) ;
alsoTankCutscene . animation . addByPrefix ( ' s w a g T a n k ' , ' T A N K T A L K 3 P 2 U N C U T ' , 24 , false ) ;
alsoTankCutscene . antialiasing = true ;
2021-04-08 22:50:29 -04:00
2021-04-18 05:25:44 -04:00
bfTankCutsceneLayer . add ( alsoTankCutscene ) ;
2021-04-08 22:50:29 -04:00
2021-04-18 05:25:44 -04:00
alsoTankCutscene . y = FlxG . height + 100 ;
2021-04-08 22:50:29 -04:00
2021-04-18 05:25:44 -04:00
camFollow . setPosition ( gf . x + 350 , gf . y + 560 ) ;
FlxG . camera . focusOn ( camFollow . getPosition ( ) ) ;
2021-04-07 20:19:49 -04:00
2021-04-18 05:25:44 -04:00
boyfriend . visible = false ;
2021-04-08 20:48:11 -04:00
2021-04-18 05:25:44 -04:00
var fakeBF: Character = new Character ( boyfriend . x , boyfriend . y , ' b f ' , true ) ;
bfTankCutsceneLayer . add ( fakeBF ) ;
2021-04-08 20:48:11 -04:00
2021-04-18 05:25:44 -04:00
// var atlasCutscene:Animation
// var animAssets:AssetManager = new AssetManager();
2021-04-11 19:08:36 -04:00
2021-04-18 05:25:44 -04:00
// var url = 'images/gfDemon';
2021-04-11 19:08:36 -04:00
2021-04-18 05:25:44 -04:00
// // animAssets.enqueueSingle(Paths.file(url + "/spritemap1.png"));
// // animAssets.enqueueSingle(Paths.file(url + "/spritemap1.json"));
// // animAssets.enqueueSingle(Paths.file(url + "/Animation.json"));
2021-04-11 19:08:36 -04:00
2021-04-18 05:25:44 -04:00
// animAssets.loadQueue(function(asssss:AssetManager)
// {
// var daAnim:Animation = asssss.createAnimation('GF Turnin Demon W Effect');
// FlxG.addChildBelowMouse(daAnim);
// });
2021-04-11 19:08:36 -04:00
2021-04-18 05:25:44 -04:00
var bfCatchGf: FlxSprite = new FlxSprite ( boyfriend . x - 10 , boyfriend . y - 90 ) ;
bfCatchGf . frames = Paths . getSparrowAtlas ( ' c u t s c e n e S t u f f / b f C a t c h e s G F ' ) ;
bfCatchGf . animation . addByPrefix ( ' c a t c h ' , ' B F c a t c h e s G F ' , 24 , false ) ;
bfCatchGf . antialiasing = true ;
add ( bfCatchGf ) ;
bfCatchGf . visible = false ;
2021-04-07 20:19:49 -04:00
2021-04-18 05:25:44 -04:00
if ( PreferencesMenu . getPref ( ' c e n s o r - n a u g h t y ' ) )
tankCutscene . startSyncAudio = FlxG . sound . play ( Paths . sound ( ' s t r e s s C u t s c e n e ' ) ) ;
e lse
2021-04-09 03:03:27 -04:00
{
2021-04-18 05:25:44 -04:00
tankCutscene . startSyncAudio = FlxG . sound . play ( Paths . sound ( ' s o n g 3 c e n s o r ' ) ) ;
// cutsceneSound.loadEmbedded(Paths.sound('song3censor'));
var censor: FlxSprite = new FlxSprite ( ) ;
censor . frames = Paths . getSparrowAtlas ( ' c u t s c e n e S t u f f / c e n s o r ' ) ;
censor . animation . addByPrefix ( ' c e n s o r ' , ' m o u t h c e n s o r ' , 24 ) ;
censor . animation . play ( ' c e n s o r ' ) ;
add ( censor ) ;
censor . visible = false ;
//
new FlxTimer ( ) . start ( 4.6 , function ( censorTimer : FlxTimer )
2021-04-09 03:03:27 -04:00
{
2021-04-18 05:25:44 -04:00
censor . visible = true ;
censor . setPosition ( dad . x + 160 , dad . y + 180 ) ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 0.2 , function ( endThing : FlxTimer )
{
censor . visible = false ;
} ) ;
} ) ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 25.1 , function ( censorTimer : FlxTimer )
2021-04-09 03:03:27 -04:00
{
2021-04-18 05:25:44 -04:00
censor . visible = true ;
censor . setPosition ( dad . x + 120 , dad . y + 170 ) ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 0.9 , function ( endThing : FlxTimer )
{
censor . visible = false ;
} ) ;
} ) ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 30.7 , function ( censorTimer : FlxTimer )
2021-04-09 03:03:27 -04:00
{
2021-04-18 05:25:44 -04:00
censor . visible = true ;
censor . setPosition ( dad . x + 210 , dad . y + 190 ) ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 0.4 , function ( endThing : FlxTimer )
{
censor . visible = false ;
} ) ;
} ) ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 33.8 , function ( censorTimer : FlxTimer )
2021-04-09 03:03:27 -04:00
{
2021-04-18 05:25:44 -04:00
censor . visible = true ;
censor . setPosition ( dad . x + 180 , dad . y + 170 ) ;
new FlxTimer ( ) . start ( 0.6 , function ( endThing : FlxTimer )
{
censor . visible = false ;
} ) ;
2021-04-09 03:03:27 -04:00
} ) ;
2021-04-18 05:25:44 -04:00
}
2021-04-07 20:19:49 -04:00
2021-04-18 05:25:44 -04:00
// new FlxTimer().start(0.01, function(tmr) cutsceneSound.play()); // cutsceneSound.play();
// cutsceneSound.play();
// tankCutscene.startSyncAudio = cutsceneSound;
// tankCutscene.animation.curAnim.curFrame
2021-04-07 20:19:49 -04:00
2021-04-18 05:25:44 -04:00
FlxG . camera . zoom = defaultCamZoom * 1.15 ;
2021-04-08 17:31:08 -04:00
2021-04-18 05:25:44 -04:00
camFollow . x -= 200 ;
2021-04-08 17:31:08 -04:00
2021-04-18 05:25:44 -04:00
// cutsceneSound.onComplete = startCountdown;
2021-04-07 20:19:49 -04:00
2021-04-18 05:25:44 -04:00
// Cunt 1
new FlxTimer ( ) . start ( 31.5 , function ( cunt : FlxTimer )
2021-04-08 18:59:37 -04:00
{
2021-04-18 05:25:44 -04:00
camFollow . x += 400 ;
camFollow . y += 150 ;
FlxG . camera . zoom = defaultCamZoom * 1.4 ;
FlxTween . tween ( FlxG . camera , { zoom : FlxG . camera . zoom + 0.1 } , 0.5 , { ease : FlxEase . elasticOut } ) ;
2021-04-08 18:59:37 -04:00
FlxG . camera . focusOn ( camFollow . getPosition ( ) ) ;
2021-04-18 05:25:44 -04:00
boyfriend . playAnim ( ' s i n g U P m i s s ' ) ;
boyfriend . animation . finishCallback = function ( animFinish : String )
{
camFollow . x -= 400 ;
camFollow . y -= 150 ;
FlxG . camera . zoom /= 1.4 ;
FlxG . camera . focusOn ( camFollow . getPosition ( ) ) ;
2021-04-08 18:59:37 -04:00
2021-04-18 05:25:44 -04:00
boyfriend . animation . finishCallback = null ;
} ;
2021-04-07 20:19:49 -04:00
} ) ;
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 15.1 , function ( tmr : FlxTimer )
2021-04-07 20:19:49 -04:00
{
2021-04-18 05:25:44 -04:00
camFollow . y -= 170 ;
camFollow . x += 200 ;
FlxTween . tween ( FlxG . camera , { zoom : FlxG . camera . zoom * 1.3 } , 2.1 , {
ease : FlxEase . quadInOut
} ) ;
2021-04-08 20:48:11 -04:00
2021-04-18 05:25:44 -04:00
new FlxTimer ( ) . start ( 2.2 , function ( swagTimer : FlxTimer )
2021-04-07 20:19:49 -04:00
{
2021-04-18 05:25:44 -04:00
// FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, 0.7, {ease: FlxEase.elasticOut});
FlxG . camera . zoom = 0.8 ;
// camFollow.y -= 100;
boyfriend . visible = false ;
bfCatchGf . visible = true ;
bfCatchGf . animation . play ( ' c a t c h ' ) ;
2021-04-08 17:31:08 -04:00
2021-04-18 05:25:44 -04:00
bfTankCutsceneLayer . remove ( fakeBF ) ;
2021-04-08 18:59:37 -04:00
2021-04-18 05:25:44 -04:00
bfCatchGf . animation . finishCallback = function ( anim : String )
{
bfCatchGf . visible = false ;
boyfriend . visible = true ;
} ;
new FlxTimer ( ) . start ( 3 , function ( weedShitBaby : FlxTimer )
{
camFollow . y += 180 ;
camFollow . x -= 80 ;
} ) ;
new FlxTimer ( ) . start ( 2.3 , function ( gayLol : FlxTimer )
{
bfTankCutsceneLayer . remove ( tankCutscene ) ;
alsoTankCutscene . y = 320 ;
alsoTankCutscene . animation . play ( ' s w a g T a n k ' ) ;
// tankCutscene.animation.play('weed');
} ) ;
2021-04-08 18:59:37 -04:00
} ) ;
2021-04-07 20:19:49 -04:00
2021-04-18 05:25:44 -04:00
gf . visible = false ;
var cutsceneShit: CutsceneCharacter = new CutsceneCharacter ( 210 , 70 , ' g f H o l d u p ' ) ;
gfCutsceneLayer . add ( cutsceneShit ) ;
gfCutsceneLayer . remove ( gfTankmen ) ;
2021-04-08 20:48:11 -04:00
2021-04-18 05:25:44 -04:00
cutsceneShit . onFinish = function ( )
{
gf . alpha = 1 ;
gf . visible = true ;
} ;
2021-04-09 03:03:27 -04:00
2021-04-18 05:25:44 -04:00
// add(cutsceneShit);
new FlxTimer ( ) . start ( 20 , function ( alsoTmr : FlxTimer )
{
dad . visible = true ;
bfTankCutsceneLayer . remove ( alsoTankCutscene ) ;
startCountdown ( ) ;
remove ( dummyLoaderShit ) ;
dummyLoaderShit . destroy ( ) ;
dummyLoaderShit = null ;
2021-04-10 01:49:57 -04:00
2021-04-18 05:25:44 -04:00
gfCutsceneLayer . remove ( cutsceneShit ) ;
} ) ;
} ) ; * /
2021-04-07 20:19:49 -04:00
}
2021-03-18 20:26:17 -04:00
function initDiscord ( ) : Void
{
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-04-10 01:49:57 -04:00
storyDifficultyText = difficultyString ( ) ;
2021-03-18 20:26:17 -04:00
iconRPC = SONG . player2 ;
// To avoid having duplicate images in Discord assets
switch ( iconRPC )
{
c ase ' s e n p a i - a n g r y ' :
iconRPC = ' s e n p a i ' ;
c ase ' m o n s t e r - c h r i s t m a s ' :
iconRPC = ' m o n s t e r ' ;
c ase ' m o m - c a r ' :
iconRPC = ' m o m ' ;
}
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
detailsText = isStoryMode ? " S t o r y M o d e : W e e k " + storyWeek : " F r e e p l a y " ;
detailsPausedText = " P a u s e d - " + detailsText ;
// Updating Discord Rich Presence.
DiscordClient . changePresence ( detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC ) ;
#end
}
2021-02-01 01:50:30 -05:00
function schoolIntro ( ? dialogueBox : DialogueBox ) : Void
2021-01-25 04:18:44 -05:00
{
var black: FlxSprite = new FlxSprite ( - 100 , - 100 ) . makeGraphic ( FlxG . width * 2 , FlxG . height * 2 , FlxColor . BLACK ) ;
black . scrollFactor . set ( ) ;
add ( black ) ;
2021-02-02 05:46:17 -05:00
var red: FlxSprite = new FlxSprite ( - 100 , - 100 ) . makeGraphic ( FlxG . width * 2 , FlxG . height * 2 , 0xFFff1b31 ) ;
red . scrollFactor . set ( ) ;
var senpaiEvil: FlxSprite = new FlxSprite ( ) ;
2021-02-08 16:34:48 -05:00
senpaiEvil . frames = Paths . getSparrowAtlas ( ' w e e b / s e n p a i C r a z y ' ) ;
2021-02-02 05:46:17 -05:00
senpaiEvil . animation . addByPrefix ( ' i d l e ' , ' S e n p a i P r e E x p l o s i o n ' , 24 , false ) ;
2021-04-14 21:56:42 -04:00
senpaiEvil . setGraphicSize ( Std . int ( senpaiEvil . width * daPixelZoom ) ) ;
2021-02-12 01:20:20 -05:00
senpaiEvil . scrollFactor . set ( ) ;
2021-02-02 05:46:17 -05:00
senpaiEvil . updateHitbox ( ) ;
senpaiEvil . screenCenter ( ) ;
2021-04-14 21:56:42 -04:00
senpaiEvil . x += senpaiEvil . width / 5 ;
camFollow . setPosition ( camPos . x , camPos . y ) ;
2021-02-02 05:46:17 -05:00
if ( SONG . song . toLowerCase ( ) == ' r o s e s ' || SONG . song . toLowerCase ( ) == ' t h o r n s ' )
{
2021-02-02 04:13:28 -05:00
remove ( black ) ;
2021-02-02 05:46:17 -05:00
if ( SONG . song . toLowerCase ( ) == ' t h o r n s ' )
{
add ( red ) ;
2021-04-14 21:56:42 -04:00
camHUD . visible = false ;
2021-02-02 05:46:17 -05:00
}
2021-04-21 22:17:00 -04:00
e lse
FlxG . sound . play ( Paths . sound ( ' A N G R Y ' ) ) ;
// moved senpai angry noise in here to clean up cutscene switch case lol
2021-02-02 05:46:17 -05:00
}
2021-01-25 04:18:44 -05:00
new FlxTimer ( ) . start ( 0.3 , function ( tmr : FlxTimer )
{
black . alpha -= 0.15 ;
if ( black . alpha > 0 )
tmr . reset ( 0.3 ) ;
e lse
{
2021-02-01 01:50:30 -05:00
if ( dialogueBox != null )
{
2021-02-02 02:35:35 -05:00
inCutscene = true ;
2021-02-02 05:46:17 -05:00
if ( SONG . song . toLowerCase ( ) == ' t h o r n s ' )
{
add ( senpaiEvil ) ;
senpaiEvil . alpha = 0 ;
new FlxTimer ( ) . start ( 0.3 , function ( swagTimer : FlxTimer )
{
senpaiEvil . alpha += 0.15 ;
if ( senpaiEvil . alpha < 1 )
swagTimer . reset ( ) ;
e lse
{
senpaiEvil . animation . play ( ' i d l e ' ) ;
2021-02-08 16:34:48 -05:00
FlxG . sound . play ( Paths . sound ( ' S e n p a i _ D i e s ' ) , 1 , false , null , true , function ( )
2021-02-02 05:46:17 -05:00
{
remove ( senpaiEvil ) ;
remove ( red ) ;
FlxG . camera . fade ( FlxColor . WHITE , 0.01 , true , function ( )
{
add ( dialogueBox ) ;
2021-04-14 21:56:42 -04:00
camHUD . visible = true ;
2021-02-02 05:46:17 -05:00
} , true ) ;
} ) ;
new FlxTimer ( ) . start ( 3.2 , function ( deadTime : FlxTimer )
{
FlxG . camera . fade ( FlxColor . WHITE , 1.6 , false ) ;
} ) ;
}
} ) ;
}
e lse
add ( dialogueBox ) ;
2021-02-01 01:50:30 -05:00
}
e lse
startCountdown ( ) ;
2021-01-25 04:18:44 -05:00
remove ( black ) ;
}
} ) ;
}
2021-03-30 12:43:07 -04:00
var startTimer: FlxTimer = new FlxTimer ( ) ;
2020-12-22 20:55:03 -05:00
var perfectMode: Bool = false ;
2020-10-26 05:16:05 -04:00
2020-10-23 19:12:38 -04:00
function startCountdown ( ) : Void
{
2021-02-02 02:35:35 -05:00
inCutscene = false ;
2021-04-18 05:25:44 -04:00
camHUD . visible = true ;
2021-02-02 02:35:35 -05:00
2020-10-31 21:11:14 -04:00
generateStaticArrows ( 0 ) ;
generateStaticArrows ( 1 ) ;
talking = false ;
2021-09-24 10:56:05 -04:00
restartCountdownTimer ( ) ;
}
function restartCountdownTimer ( ) : Void
{
2020-10-23 19:12:38 -04:00
startedCountdown = true ;
2021-09-24 10:56:05 -04:00
2020-10-05 18:29:59 -04:00
Conductor . songPosition = 0 ;
2020-10-05 16:32:41 -04:00
Conductor . songPosition -= Conductor . crochet * 5 ;
2020-10-05 14:24:51 -04:00
2020-10-23 19:12:38 -04:00
var swagCounter: Int = 0 ;
2021-03-30 12:43:07 -04:00
startTimer . start ( Conductor . crochet / 1000 , function ( tmr : FlxTimer )
2020-10-05 14:24:51 -04:00
{
2021-03-17 13:33:26 -04:00
// this just based on beatHit stuff but compact
if ( swagCounter % gfSpeed == 0 )
gf . dance ( ) ;
if ( swagCounter % 2 == 0 )
{
if ( ! boyfriend . animation . curAnim . name . startsWith ( " s i n g " ) )
boyfriend . playAnim ( ' i d l e ' ) ;
if ( ! dad . animation . curAnim . name . startsWith ( " s i n g " ) )
dad . dance ( ) ;
}
e lse if ( dad . curCharacter == ' s p o o k y ' && ! dad . animation . curAnim . name . startsWith ( " s i n g " ) )
dad . dance ( ) ;
2021-04-02 20:03:53 -04:00
if ( generatedMusic )
notes . sort ( sortNotes , FlxSort . DESCENDING ) ;
2020-10-30 19:47:19 -04:00
2021-04-21 22:17:00 -04:00
var introSprPaths: Array < String > = [ " r e a d y " , " s e t " , " g o " ] ;
2021-01-25 15:56:42 -05:00
var altSuffix: String = " " ;
2021-01-25 04:18:44 -05:00
2021-04-21 22:17:00 -04:00
if ( curStage . startsWith ( " s c h o o l " ) )
2021-01-25 04:18:44 -05:00
{
2021-04-21 22:17:00 -04:00
altSuffix = ' - p i x e l ' ;
introSprPaths = [ ' w e e b / p i x e l U I / r e a d y - p i x e l ' , ' w e e b / p i x e l U I / s e t - p i x e l ' , ' w e e b / p i x e l U I / d a t e - p i x e l ' ] ;
2021-01-25 04:18:44 -05:00
}
2021-06-05 00:01:15 -04:00
var introSndPaths: Array < String > = [
" i n t r o 3 " + altSuffix , " i n t r o 2 " + altSuffix ,
" i n t r o 1 " + altSuffix , " i n t r o G o " + altSuffix
] ;
2021-04-21 22:17:00 -04:00
if ( swagCounter > 0 )
readySetGo ( introSprPaths [ swagCounter - 1 ] ) ;
FlxG . sound . play ( Paths . sound ( introSndPaths [ swagCounter ] ) , 0.6 ) ;
2021-01-25 04:18:44 -05:00
2021-04-21 22:17:00 -04:00
/ * switch ( swagCounter )
2021-06-05 00:01:15 -04:00
{
c ase 0 :
c ase 1 :
c ase 2 :
c ase 3 :
} * /
2021-01-25 04:18:44 -05:00
2021-04-21 22:17:00 -04:00
swagCounter += 1 ;
} , 4 ) ;
}
2021-01-25 04:18:44 -05:00
2021-04-21 22:17:00 -04:00
function readySetGo ( path : String ) : Void
{
var spr: FlxSprite = new FlxSprite ( ) . loadGraphic ( Paths . image ( path ) ) ;
spr . scrollFactor . set ( ) ;
2021-01-25 04:18:44 -05:00
2021-04-21 22:17:00 -04:00
if ( curStage . startsWith ( ' s c h o o l ' ) )
spr . setGraphicSize ( Std . int ( spr . width * daPixelZoom ) ) ;
spr . updateHitbox ( ) ;
spr . screenCenter ( ) ;
add ( spr ) ;
FlxTween . tween ( spr , { y : spr . y += 100 , alpha : 0 } , Conductor . crochet / 1000 , {
ease : FlxEase . cubeInOut ,
onComplete : function ( twn : FlxTween )
{
spr . destroy ( ) ;
2020-10-05 14:24:51 -04:00
}
2021-04-21 22:17:00 -04:00
} ) ;
2020-10-03 02:50:15 -04:00
}
2020-10-24 05:19:13 -04:00
var previousFrameTime: Int = 0 ;
var songTime: Float = 0 ;
2020-10-05 14:24:51 -04:00
function startSong ( ) : Void
{
2020-12-10 00:41:31 -05:00
startingSong = false ;
2020-10-24 05:19:13 -04:00
previousFrameTime = FlxG . game . ticks ;
2020-12-10 00:41:31 -05:00
if ( ! paused )
2021-09-24 10:56:05 -04:00
{
2021-11-02 10:28:26 -04:00
// if (FlxG.sound.music != null)
// FlxG.sound.music.play(true);
// else
FlxG . sound . playMusic ( Paths . inst ( SONG . song ) , 1 , false ) ;
2021-09-24 10:56:05 -04:00
}
2020-10-31 21:11:14 -04:00
FlxG . sound . music . onComplete = endSong ;
2020-10-05 14:24:51 -04:00
vocals . play ( ) ;
2021-02-27 16:59:18 -05:00
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 16:59:18 -05:00
// Song duration in a float, useful for the time left feature
songLength = FlxG . sound . music . length ;
// Updating Discord Rich Presence (with Time Left)
2021-02-27 18:23:50 -05:00
DiscordClient . changePresence ( detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC , true , songLength ) ;
2021-02-27 16:59:18 -05:00
#end
2020-10-05 14:24:51 -04:00
}
2021-03-29 13:24:49 -04:00
private function generateSong ( ) : Void
2020-10-03 02:50:15 -04:00
{
2020-10-04 02:42:58 -04:00
// FlxG.log.add(ChartParser.parse());
2021-09-24 10:56:05 -04:00
Conductor . changeBPM ( SONG . bpm ) ;
2020-10-04 02:42:58 -04:00
2021-09-24 10:56:05 -04:00
curSong = SONG . song ;
2020-10-05 05:48:30 -04:00
2020-10-14 04:30:54 -04:00
if ( SONG . needsVoices )
2021-09-20 22:08:24 -04:00
vocals = new VoicesGroup ( SONG . song , SONG . voiceList ) ;
2020-10-14 04:30:54 -04:00
e lse
2021-09-20 11:50:52 -04:00
vocals = new VoicesGroup ( SONG . song , null , false ) ;
2020-10-14 04:30:54 -04:00
2021-09-20 11:50:52 -04:00
vocals . members [ 0 ] . onComplete = function ( )
2021-04-09 16:37:54 -04:00
{
2021-04-08 08:17:21 -04:00
vocalsFinished = true ;
} ;
2020-10-03 02:50:15 -04:00
notes = new FlxTypedGroup < Note > ( ) ;
add ( notes ) ;
2021-09-24 10:56:05 -04:00
regenNoteData ( ) ;
generatedMusic = true ;
}
function regenNoteData ( ) : Void
{
// make unspawn notes shit def empty
unspawnNotes = [ ] ;
notes . forEach ( function ( nt )
{
2021-12-06 22:35:14 -05:00
nt . followsTime = false ;
2021-12-06 22:39:03 -05:00
FlxTween . tween ( nt , { y : FlxG . height + nt . y } , 0.5 , {
2021-12-06 22:35:14 -05:00
ease : FlxEase . expoIn ,
onComplete : function ( twn )
{
nt . kill ( ) ;
notes . remove ( nt , true ) ;
nt . destroy ( ) ;
}
} ) ;
2021-09-24 10:56:05 -04:00
} ) ;
2020-10-24 05:19:13 -04:00
var noteData: Array < SwagSection > ;
2020-10-04 02:42:58 -04:00
2020-10-13 04:37:19 -04:00
// NEW SHIT
2021-12-06 17:49:05 -05:00
noteData = SongLoad . getSong ( ) ;
2020-10-13 04:37:19 -04:00
2020-10-16 07:03:10 -04:00
for ( section in noteData )
2020-10-03 02:50:15 -04:00
{
2020-10-18 20:59:53 -04:00
for ( songNotes in section . sectionNotes )
2020-10-16 07:03:10 -04:00
{
2022-01-21 17:23:12 -05:00
var daStrumTime: Float = songNotes . strumTime ;
var daNoteData: Int = Std . int ( songNotes . noteData % 4 ) ;
2020-10-17 21:47:59 -04:00
var gottaHitNote: Bool = section . mustHitSection ;
2022-02-09 20:31:36 -05:00
if ( songNotes . highStakes )
2020-10-17 21:47:59 -04:00
gottaHitNote = ! section . mustHitSection ;
2020-10-13 04:37:19 -04:00
2020-10-16 07:03:10 -04:00
var oldNote: Note ;
if ( unspawnNotes . length > 0 )
oldNote = unspawnNotes [ Std . int ( unspawnNotes . length - 1 ) ] ;
e lse
oldNote = null ;
2020-10-05 01:13:12 -04:00
2020-10-16 07:03:10 -04:00
var swagNote: Note = new Note ( daStrumTime , daNoteData , oldNote ) ;
2022-01-22 16:53:38 -05:00
swagNote . data . sustainLength = songNotes . sustainLength ;
swagNote . data . altNote = songNotes . altNote ;
2020-10-16 07:03:10 -04:00
swagNote . scrollFactor . set ( 0 , 0 ) ;
2020-10-03 02:50:15 -04:00
2022-01-22 16:53:38 -05:00
var susLength: Float = swagNote . data . sustainLength ;
2020-10-19 21:59:00 -04:00
susLength = susLength / Conductor . stepCrochet ;
2020-10-16 07:03:10 -04:00
unspawnNotes . push ( swagNote ) ;
2020-10-05 05:48:30 -04:00
2021-08-01 21:29:34 -04:00
for ( susNote in 0 ... Math . round ( susLength ) )
2020-10-19 21:59:00 -04:00
{
oldNote = unspawnNotes [ Std . int ( unspawnNotes . length - 1 ) ] ;
2020-10-21 16:12:32 -04:00
var sustainNote: Note = new Note ( daStrumTime + ( Conductor . stepCrochet * susNote ) + Conductor . stepCrochet , daNoteData , oldNote , true ) ;
2020-10-19 21:59:00 -04:00
sustainNote . scrollFactor . set ( ) ;
unspawnNotes . push ( sustainNote ) ;
sustainNote . mustPress = gottaHitNote ;
if ( sustainNote . mustPress )
sustainNote . x += FlxG . width / 2 ; // general offset
}
2020-10-17 21:47:59 -04:00
swagNote . mustPress = gottaHitNote ;
2020-10-03 02:50:15 -04:00
2020-10-16 07:03:10 -04:00
if ( swagNote . mustPress )
2020-10-16 07:15:17 -04:00
swagNote . x += FlxG . width / 2 ; // general offset
2020-10-03 02:50:15 -04:00
}
}
2020-10-05 05:48:30 -04:00
unspawnNotes . sort ( sortByShit ) ;
}
2021-04-01 22:28:20 -04:00
// Now you are probably wondering why I made 2 of these very similar functions
// sortByShit(), and sortNotes(). sortNotes is meant to be used by both sortByShit(), and the notes FlxGroup
// sortByShit() is meant to be used only by the unspawnNotes array.
// and the array sorting function doesnt need that order variable thingie
// this is good enough for now lololol HERE IS COMMENT FOR THIS SORTA DUMB DECISION LOL
2020-10-05 05:48:30 -04:00
function sortByShit ( Obj1 : Note , Obj2 : Note ) : Int
{
2021-04-01 22:28:20 -04:00
return sortNotes ( FlxSort . ASCENDING , Obj1 , Obj2 ) ;
}
function sortNotes ( order : Int = FlxSort . ASCENDING , Obj1 : Note , Obj2 : Note )
{
2022-01-22 16:53:38 -05:00
return FlxSort . byValues ( order , Obj1 . data . strumTime , Obj2 . data . strumTime ) ;
2020-10-03 02:50:15 -04:00
}
2021-04-01 22:28:20 -04:00
// ^ These two sorts also look cute together ^
2020-10-04 04:38:21 -04:00
private function generateStaticArrows ( player : Int ) : Void
{
for ( i in 0 ... 4 )
{
2021-01-25 04:18:44 -05:00
// FlxG.log.add(i);
2020-10-04 04:38:21 -04:00
var babyArrow: FlxSprite = new FlxSprite ( 0 , strumLine . y ) ;
2021-03-21 16:29:47 -04:00
var colorswap: ColorSwap = new ColorSwap ( ) ;
babyArrow . shader = colorswap . shader ;
colorswap . update ( Note . arrowColors [ i ] ) ;
2020-10-04 04:38:21 -04:00
2021-01-25 04:18:44 -05:00
switch ( curStage )
{
2021-02-11 14:54:16 -05:00
c ase ' s c h o o l ' | ' s c h o o l E v i l ' :
2021-02-08 16:34:48 -05:00
babyArrow . loadGraphic ( Paths . image ( ' w e e b / p i x e l U I / a r r o w s - p i x e l s ' ) , true , 17 , 17 ) ;
2021-02-02 00:48:22 -05:00
babyArrow . animation . add ( ' g r e e n ' , [ 6 ] ) ;
babyArrow . animation . add ( ' r e d ' , [ 7 ] ) ;
babyArrow . animation . add ( ' b l u e ' , [ 5 ] ) ;
babyArrow . animation . add ( ' p u r p l e l ' , [ 4 ] ) ;
babyArrow . setGraphicSize ( Std . int ( babyArrow . width * daPixelZoom ) ) ;
babyArrow . updateHitbox ( ) ;
babyArrow . antialiasing = false ;
switch ( Math . abs ( i ) )
{
2021-02-13 17:39:31 -05:00
c ase 0 :
babyArrow . x += Note . swagWidth * 0 ;
babyArrow . animation . add ( ' s t a t i c ' , [ 0 ] ) ;
babyArrow . animation . add ( ' p r e s s e d ' , [ 4 , 8 ] , 12 , false ) ;
babyArrow . animation . add ( ' c o n f i r m ' , [ 12 , 16 ] , 24 , false ) ;
c ase 1 :
babyArrow . x += Note . swagWidth * 1 ;
babyArrow . animation . add ( ' s t a t i c ' , [ 1 ] ) ;
babyArrow . animation . add ( ' p r e s s e d ' , [ 5 , 9 ] , 12 , false ) ;
babyArrow . animation . add ( ' c o n f i r m ' , [ 13 , 17 ] , 24 , false ) ;
2021-02-02 00:48:22 -05:00
c ase 2 :
babyArrow . x += Note . swagWidth * 2 ;
babyArrow . animation . add ( ' s t a t i c ' , [ 2 ] ) ;
babyArrow . animation . add ( ' p r e s s e d ' , [ 6 , 10 ] , 12 , false ) ;
babyArrow . animation . add ( ' c o n f i r m ' , [ 14 , 18 ] , 12 , false ) ;
c ase 3 :
babyArrow . x += Note . swagWidth * 3 ;
babyArrow . animation . add ( ' s t a t i c ' , [ 3 ] ) ;
babyArrow . animation . add ( ' p r e s s e d ' , [ 7 , 11 ] , 12 , false ) ;
babyArrow . animation . add ( ' c o n f i r m ' , [ 15 , 19 ] , 24 , false ) ;
}
2021-01-25 04:18:44 -05:00
d efault :
2021-02-08 16:34:48 -05:00
babyArrow . frames = Paths . getSparrowAtlas ( ' N O T E _ a s s e t s ' ) ;
2021-01-25 04:18:44 -05:00
babyArrow . animation . addByPrefix ( ' g r e e n ' , ' a r r o w U P ' ) ;
babyArrow . animation . addByPrefix ( ' b l u e ' , ' a r r o w D O W N ' ) ;
babyArrow . animation . addByPrefix ( ' p u r p l e ' , ' a r r o w L E F T ' ) ;
babyArrow . animation . addByPrefix ( ' r e d ' , ' a r r o w R I G H T ' ) ;
babyArrow . antialiasing = true ;
babyArrow . setGraphicSize ( Std . int ( babyArrow . width * 0.7 ) ) ;
switch ( Math . abs ( i ) )
{
2021-02-13 17:39:31 -05:00
c ase 0 :
babyArrow . x += Note . swagWidth * 0 ;
2021-03-20 01:03:42 -04:00
babyArrow . animation . addByPrefix ( ' s t a t i c ' , ' a r r o w s t a t i c i n s t a n c e 1 ' ) ;
2021-02-13 17:39:31 -05:00
babyArrow . animation . addByPrefix ( ' p r e s s e d ' , ' l e f t p r e s s ' , 24 , false ) ;
babyArrow . animation . addByPrefix ( ' c o n f i r m ' , ' l e f t c o n f i r m ' , 24 , false ) ;
c ase 1 :
babyArrow . x += Note . swagWidth * 1 ;
2021-03-20 01:03:42 -04:00
babyArrow . animation . addByPrefix ( ' s t a t i c ' , ' a r r o w s t a t i c i n s t a n c e 2 ' ) ;
2021-02-13 17:39:31 -05:00
babyArrow . animation . addByPrefix ( ' p r e s s e d ' , ' d o w n p r e s s ' , 24 , false ) ;
babyArrow . animation . addByPrefix ( ' c o n f i r m ' , ' d o w n c o n f i r m ' , 24 , false ) ;
2021-01-25 04:18:44 -05:00
c ase 2 :
babyArrow . x += Note . swagWidth * 2 ;
2021-03-20 01:03:42 -04:00
babyArrow . animation . addByPrefix ( ' s t a t i c ' , ' a r r o w s t a t i c i n s t a n c e 4 ' ) ;
2021-01-25 04:18:44 -05:00
babyArrow . animation . addByPrefix ( ' p r e s s e d ' , ' u p p r e s s ' , 24 , false ) ;
babyArrow . animation . addByPrefix ( ' c o n f i r m ' , ' u p c o n f i r m ' , 24 , false ) ;
c ase 3 :
babyArrow . x += Note . swagWidth * 3 ;
2021-03-20 01:03:42 -04:00
babyArrow . animation . addByPrefix ( ' s t a t i c ' , ' a r r o w s t a t i c i n s t a n c e 3 ' ) ;
2021-01-25 04:18:44 -05:00
babyArrow . animation . addByPrefix ( ' p r e s s e d ' , ' r i g h t p r e s s ' , 24 , false ) ;
babyArrow . animation . addByPrefix ( ' c o n f i r m ' , ' r i g h t c o n f i r m ' , 24 , false ) ;
}
}
2020-10-04 04:38:21 -04:00
babyArrow . updateHitbox ( ) ;
2021-01-25 04:18:44 -05:00
babyArrow . scrollFactor . set ( ) ;
2020-10-04 04:38:21 -04:00
2021-02-12 01:20:20 -05:00
if ( ! isStoryMode )
{
babyArrow . y -= 10 ;
babyArrow . alpha = 0 ;
FlxTween . tween ( babyArrow , { y : babyArrow . y + 10 , alpha : 1 } , 1 , { ease : FlxEase . circOut , startDelay : 0.5 + ( 0.2 * i ) } ) ;
}
2020-10-05 14:24:51 -04:00
2020-10-13 22:12:31 -04:00
babyArrow . ID = i ;
2020-10-04 04:38:21 -04:00
if ( player == 1 )
playerStrums . add ( babyArrow ) ;
babyArrow . animation . play ( ' s t a t i c ' ) ;
babyArrow . x += 50 ;
babyArrow . x += ( ( FlxG . width / 2 ) * player ) ;
strumLineNotes . add ( babyArrow ) ;
}
}
2020-10-31 21:11:14 -04:00
function tweenCamIn ( ) : Void
{
2021-08-21 20:45:03 -04:00
FlxTween . tween ( FlxG . camera , { zoom : 1.3 * FlxCamera . defaultZoom } , ( Conductor . stepCrochet * 4 / 1000 ) , { ease : FlxEase . elasticInOut } ) ;
2020-10-31 21:11:14 -04:00
}
2020-10-09 17:24:20 -04:00
override function openSubState ( SubState : FlxSubState )
{
if ( paused )
{
2020-10-26 05:16:05 -04:00
if ( FlxG . sound . music != null )
{
FlxG . sound . music . pause ( ) ;
vocals . pause ( ) ;
}
if ( ! startTimer . finished )
startTimer . active = false ;
2020-10-09 17:24:20 -04:00
}
super . openSubState ( SubState ) ;
}
override function closeSubState ( )
{
if ( paused )
{
2020-12-10 00:04:36 -05:00
if ( FlxG . sound . music != null && ! startingSong )
2020-12-13 01:42:48 -05:00
resyncVocals ( ) ;
2020-10-26 05:16:05 -04:00
if ( ! startTimer . finished )
startTimer . active = true ;
2020-10-09 17:24:20 -04:00
paused = false ;
2021-02-27 18:23:50 -05:00
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 18:23:50 -05:00
if ( startTimer . finished )
DiscordClient . changePresence ( detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC , true , songLength - Conductor . songPosition ) ;
e lse
DiscordClient . changePresence ( detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC ) ;
#end
2020-10-09 17:24:20 -04:00
}
super . closeSubState ( ) ;
}
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 18:49:53 -05:00
override public function onFocus ( ) : Void
{
2021-04-08 12:45:59 -04:00
if ( health > 0 && ! paused && FlxG . autoPause )
2021-02-27 18:49:53 -05:00
{
if ( Conductor . songPosition > 0.0 )
DiscordClient . changePresence ( detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC , true , songLength - Conductor . songPosition ) ;
e lse
DiscordClient . changePresence ( detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC ) ;
}
super . onFocus ( ) ;
}
2021-03-18 19:12:39 -04:00
2021-02-27 18:49:53 -05:00
override public function onFocusLost ( ) : Void
{
2021-04-08 12:45:59 -04:00
if ( health > 0 && ! paused && FlxG . autoPause )
2021-02-27 18:49:53 -05:00
DiscordClient . changePresence ( detailsPausedText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC ) ;
super . onFocusLost ( ) ;
}
2021-03-22 10:09:46 -04:00
#end
2021-02-27 18:49:53 -05:00
2020-12-13 01:42:48 -05:00
function resyncVocals ( ) : Void
{
2021-04-08 08:17:21 -04:00
if ( _exiting )
2021-04-09 16:37:54 -04:00
return ;
2020-12-13 01:42:48 -05:00
2021-04-08 08:17:21 -04:00
vocals . pause ( ) ;
2020-12-13 01:42:48 -05:00
FlxG . sound . music . play ( ) ;
2021-04-18 16:54:21 -04:00
Conductor . songPosition = FlxG . sound . music . time + Conductor . offset ;
2021-04-08 08:17:21 -04:00
if ( vocalsFinished )
2021-04-09 16:37:54 -04:00
return ;
2021-04-08 08:17:21 -04:00
2021-09-08 16:28:30 -04:00
vocals . time = FlxG . sound . music . time ;
2020-12-13 01:42:48 -05:00
vocals . play ( ) ;
}
2020-10-09 17:24:20 -04:00
private var paused: Bool = false ;
2020-10-23 19:12:38 -04:00
var startedCountdown: Bool = false ;
2020-11-24 22:53:48 -05:00
var canPause: Bool = true ;
2020-10-09 17:24:20 -04:00
2020-10-03 02:50:15 -04:00
override public function update ( elapsed : Float )
{
2021-09-24 11:21:34 -04:00
healthDisplay = FlxMath . lerp ( healthDisplay , health , 0.15 ) ;
2021-09-24 11:51:15 -04:00
if ( needsReset )
2021-08-10 02:40:47 -04:00
{
2021-09-24 11:51:15 -04:00
resetCamFollow ( ) ;
paused = false ;
persistentUpdate = true ;
persistentDraw = true ;
2021-09-24 10:56:05 -04:00
startingSong = true ;
FlxG . sound . music . pause ( ) ;
2021-09-24 11:51:15 -04:00
vocals . pause ( ) ;
2021-09-24 10:56:05 -04:00
FlxG . sound . music . time = 0 ;
2021-09-27 22:30:38 -04:00
regenNoteData ( ) ; // loads the note data from start
2021-09-24 11:21:34 -04:00
health = 1 ;
2021-09-24 10:56:05 -04:00
restartCountdownTimer ( ) ;
2021-09-24 11:51:15 -04:00
needsReset = false ;
2021-08-10 02:40:47 -04:00
// FlxScreenGrab.grab(null, true, true);
/ *
var png: ByteArray = new ByteArray ( ) ;
png = FlxG . camera . screen . pixels . encode ( FlxG . camera . screen . pixels . rect , new PNGEncoderOptions ( ) ) ;
var f = sys . io . File . write ( ' . / s w a g . p n g ' , true ) ;
f . writeString ( png . readUTFBytes ( png . length ) ) ;
f . close ( ) ;
* /
// sys.io.File.saveContent('./swag.png', png.readUTFBytes(png.length));
}
2021-09-27 22:30:38 -04:00
#if ! debug
perfectMode = false ;
#else
if ( FlxG . keys . justPressed . H )
camHUD . visible = ! camHUD . visible ;
if ( FlxG . keys . justPressed . K )
{
2021-12-04 00:38:45 -05:00
// @:privateAccess
// var funnyData:Array<Int> = cast FlxG.sound.music._channel.__source.buffer.data;
2021-09-27 22:30:38 -04:00
2021-12-04 00:38:45 -05:00
// funnyData.reverse();
2021-09-27 22:30:38 -04:00
2021-12-04 00:38:45 -05:00
// @:privateAccess
// FlxG.sound.music._channel.__source.buffer.data = cast funnyData;
2021-09-27 22:30:38 -04:00
}
2020-12-22 20:55:03 -05:00
#end
2021-03-17 13:33:26 -04:00
// do this BEFORE super.update() so songPosition is accurate
if ( startingSong )
{
if ( startedCountdown )
{
Conductor . songPosition += FlxG . elapsed * 1000 ;
if ( Conductor . songPosition >= 0 )
startSong ( ) ;
}
}
e lse
{
2021-09-22 21:09:28 -04:00
if ( Paths . SOUND_EXT == ' m p 3 ' )
Conductor . offset = - 13 ; // DO NOT FORGET TO REMOVE THE HARDCODE! WHEN I MAKE BETTER OFFSET SYSTEM!
2021-04-18 16:54:21 -04:00
Conductor . songPosition = FlxG . sound . music . time + Conductor . offset ; // 20 is THE MILLISECONDS??
// Conductor.songPosition += FlxG.elapsed * 1000;
2021-03-17 13:33:26 -04:00
if ( ! paused )
{
songTime += FlxG . game . ticks - previousFrameTime ;
previousFrameTime = FlxG . game . ticks ;
// Interpolation type beat
if ( Conductor . lastSongPos != Conductor . songPosition )
{
songTime = ( songTime + Conductor . songPosition ) / 2 ;
Conductor . lastSongPos = Conductor . songPosition ;
// Conductor.songPosition += FlxG.elapsed * 1000;
// trace('MISSED FRAME');
}
}
// Conductor.lastSongPos = FlxG.sound.music.time;
}
2020-12-10 18:23:53 -05:00
switch ( curStage )
{
c ase ' p h i l l y ' :
if ( trainMoving )
{
trainFrameTiming += elapsed ;
if ( trainFrameTiming >= 1 / 24 )
{
updateTrainPos ( ) ;
trainFrameTiming = 0 ;
}
}
2021-04-18 01:43:28 -04:00
2021-04-18 03:35:43 -04:00
lightFadeShader . update ( ( Conductor . crochet / 1000 ) * FlxG . elapsed * 1.5 ) ;
// phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
c ase ' t a n k ' :
moveTank ( ) ;
2020-12-10 18:23:53 -05:00
}
2021-11-28 20:26:47 -05:00
super . update ( elapsed ) ; // idk if there's a particular reason why some code is before super.update(), and some is after. Prob nothing too much to worry about.
2020-10-03 02:50:15 -04:00
2021-09-08 20:01:55 -04:00
wiggleShit . update ( elapsed ) ;
2021-08-22 16:54:22 -04:00
var androidPause: Bool = false ;
#if android
androidPause = FlxG . android . justPressed . BACK ;
#end
if ( ( controls . PAUSE || androidPause ) && startedCountdown && canPause )
2020-10-09 17:24:20 -04:00
{
persistentUpdate = false ;
persistentDraw = true ;
paused = true ;
2021-02-16 00:21:11 -05:00
// 1 / 1000 chance for Gitaroo Man easter egg
2021-09-08 16:28:30 -04:00
// can this please move to dying it's kinda fucked up that pausing has a 1/1000 chance ur forced to restart
2021-02-16 00:21:11 -05:00
if ( FlxG . random . bool ( 0.1 ) )
{
// gitaroo man easter egg
FlxG . switchState ( new GitarooPause ( ) ) ;
}
e lse
2021-03-13 22:41:12 -05:00
{
var boyfriendPos = boyfriend . getScreenPosition ( ) ;
var pauseSubState = new PauseSubState ( boyfriendPos . x , boyfriendPos . y ) ;
openSubState ( pauseSubState ) ;
pauseSubState . camera = camHUD ;
boyfriendPos . put ( ) ;
}
2021-03-18 19:12:39 -04:00
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 18:23:50 -05:00
DiscordClient . changePresence ( detailsPausedText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC ) ;
#end
2020-10-09 17:24:20 -04:00
}
2020-11-06 21:17:27 -05:00
if ( FlxG . keys . justPressed . SEVEN )
2020-10-13 21:44:07 -04:00
{
2020-11-06 21:17:27 -05:00
FlxG . switchState ( new ChartingState ( ) ) ;
2021-02-27 19:06:30 -05:00
2021-03-22 10:09:46 -04:00
#if discord_rpc
2021-02-27 19:06:30 -05:00
DiscordClient . changePresence ( " C h a r t E d i t o r " , null , null , true ) ;
#end
2020-10-13 21:44:07 -04:00
}
2021-11-28 20:26:47 -05:00
// UI UPDATES
scoreTxt . text = " S c o r e : " + songScore ;
2021-09-10 10:07:55 -04:00
if ( FlxG . keys . justPressed . EIGHT )
FlxG . switchState ( new ui . animDebugShit . DebugBoundingState ( ) ) ;
2021-04-21 22:17:00 -04:00
if ( FlxG . keys . justPressed . NINE )
iconP1 . swapOldIcon ( ) ;
2021-05-15 17:39:13 -04:00
iconP1 . setGraphicSize ( Std . int ( CoolUtil . coolLerp ( iconP1 . width , 150 , 0.15 ) ) ) ;
iconP2 . setGraphicSize ( Std . int ( CoolUtil . coolLerp ( iconP2 . width , 150 , 0.15 ) ) ) ;
2020-12-24 18:24:11 -05:00
iconP1 . updateHitbox ( ) ;
iconP2 . updateHitbox ( ) ;
2021-01-05 07:53:42 -05:00
2020-12-24 18:24:11 -05:00
var iconOffset: Int = 26 ;
2021-09-24 11:21:34 -04:00
iconP1 . x = healthBar . x + ( healthBar . width * ( FlxMath . remapToRange ( healthBar . value , 0 , 2 , 100 , 0 ) * 0.01 ) - iconOffset ) ;
2021-09-24 11:51:15 -04:00
iconP2 . x = healthBar . x + ( healthBar . width * ( FlxMath . remapToRange ( healthBar . value , 0 , 2 , 100 , 0 ) * 0.01 ) ) - ( iconP2 . width - iconOffset ) ;
2020-10-05 16:32:41 -04:00
2020-11-01 14:16:22 -05:00
if ( health > 2 )
health = 2 ;
2020-10-24 05:19:13 -04:00
if ( healthBar . percent < 20 )
2020-12-24 18:24:11 -05:00
iconP1 . animation . curAnim . curFrame = 1 ;
2020-10-05 18:29:59 -04:00
e lse
2020-12-24 18:24:11 -05:00
iconP1 . animation . curAnim . curFrame = 0 ;
2021-01-13 22:38:31 -05:00
if ( healthBar . percent > 80 )
2021-01-14 23:33:12 -05:00
iconP2 . animation . curAnim . curFrame = 1 ;
2021-01-01 00:39:58 -05:00
e lse
2021-01-14 23:33:12 -05:00
iconP2 . animation . curAnim . curFrame = 0 ;
2021-01-05 07:53:42 -05:00
2020-10-18 20:59:53 -04:00
/ * if ( FlxG . keys . justPressed . NINE )
FlxG . switchState ( new Charting ( ) ) ; * /
2020-11-02 01:46:37 -05:00
#if debug
2021-04-21 16:58:36 -04:00
if ( FlxG . keys . justPressed . ONE )
endSong ( ) ;
2021-06-05 00:01:15 -04:00
2021-04-21 09:07:36 -04:00
if ( FlxG . keys . justPressed . PAGEUP )
changeSection ( 1 ) ;
if ( FlxG . keys . justPressed . PAGEDOWN )
changeSection ( - 1 ) ;
2020-11-02 01:46:37 -05:00
#end
2020-10-04 02:42:58 -04:00
2021-12-06 17:49:05 -05:00
if ( generatedMusic && SongLoad . getSong ( ) [ Std . int ( curStep / 16 ) ] != null )
2020-10-03 15:32:15 -04:00
{
2021-12-06 17:49:05 -05:00
cameraRightSide = SongLoad . getSong ( ) [ Std . int ( curStep / 16 ) ] . mustHitSection ;
2020-10-18 03:27:39 -04:00
2021-03-24 22:41:41 -04:00
cameraMovement ( ) ;
2020-10-03 02:50:15 -04:00
}
2020-10-05 05:48:30 -04:00
if ( camZooming )
{
2020-12-26 21:46:22 -05:00
FlxG . camera . zoom = FlxMath . lerp ( defaultCamZoom , FlxG . camera . zoom , 0.95 ) ;
2021-08-21 20:45:03 -04:00
camHUD . zoom = FlxMath . lerp ( 1 * FlxCamera . defaultZoom , camHUD . zoom , 0.95 ) ;
2020-10-05 05:48:30 -04:00
}
2021-02-11 21:19:27 -05:00
FlxG . watch . addQuick ( " b e a t S h i t " , curBeat ) ;
FlxG . watch . addQuick ( " s t e p S h i t " , curStep ) ;
2021-02-11 17:06:26 -05:00
2020-10-05 08:55:39 -04:00
if ( curSong == ' F r e s h ' )
2020-10-05 05:48:30 -04:00
{
2021-02-11 21:19:27 -05:00
switch ( curBeat )
2020-10-05 08:55:39 -04:00
{
c ase 16 :
camZooming = true ;
gfSpeed = 2 ;
c ase 48 :
gfSpeed = 1 ;
c ase 80 :
gfSpeed = 2 ;
c ase 112 :
gfSpeed = 1 ;
2020-10-05 18:29:59 -04:00
}
}
2021-03-30 12:43:07 -04:00
if ( ! inCutscene && ! _exiting )
2020-12-02 12:28:28 -05:00
{
2021-03-30 12:43:07 -04:00
// RESET = Quick Game Over Screen
if ( controls . RESET )
{
health = 0 ;
trace ( " R E S E T = T r u e " ) ;
}
2020-11-05 05:08:40 -05:00
2021-03-30 12:43:07 -04:00
#if CAN_CHEAT // brandon's a pussy
if ( controls . CHEAT )
{
health += 1 ;
trace ( " U s e r i s c h e a t i n g ! " ) ;
}
#end
2020-11-05 05:08:40 -05:00
2021-03-30 12:43:07 -04:00
if ( health <= 0 && ! practiceMode )
{
2021-04-20 11:55:42 -04:00
// boyfriend.stunned = true;
2020-10-30 19:47:19 -04:00
2021-03-30 12:43:07 -04:00
persistentUpdate = false ;
persistentDraw = false ;
paused = true ;
2020-10-30 19:47:19 -04:00
2021-09-24 11:51:15 -04:00
vocals . pause ( ) ;
FlxG . sound . music . pause ( ) ;
2020-10-30 19:47:19 -04:00
2021-04-10 01:49:57 -04:00
// unloadAssets();
2021-03-30 12:43:07 -04:00
deathCounter += 1 ;
2021-03-04 14:30:35 -05:00
2021-03-30 12:43:07 -04:00
openSubState ( new GameOverSubstate ( boyfriend . getScreenPosition ( ) . x , boyfriend . getScreenPosition ( ) . y ) ) ;
2020-10-30 19:47:19 -04:00
2021-03-30 12:43:07 -04:00
#if discord_rpc
// Game Over doesn't get his own variable because it's only used here
DiscordClient . changePresence ( " G a m e O v e r - " + detailsText , SONG . song + " ( " + storyDifficultyText + " ) " , iconRPC ) ;
#end
}
2020-10-05 18:29:59 -04:00
}
2022-01-22 16:53:38 -05:00
while ( unspawnNotes [ 0 ] != null && unspawnNotes [ 0 ] . data . strumTime - Conductor . songPosition < 1800 / SongLoad . getSpeed ( ) )
2020-10-05 05:48:30 -04:00
{
2021-03-30 17:32:57 -04:00
var dunceNote: Note = unspawnNotes [ 0 ] ;
notes . add ( dunceNote ) ;
2020-10-05 06:25:14 -04:00
2021-04-01 22:28:20 -04:00
unspawnNotes . shift ( ) ;
2020-10-05 05:48:30 -04:00
}
2020-10-03 02:50:15 -04:00
2020-10-05 14:24:51 -04:00
if ( generatedMusic )
2020-10-03 02:50:15 -04:00
{
2020-10-05 14:24:51 -04:00
notes . forEachAlive ( function ( daNote : Note )
2020-10-04 02:42:58 -04:00
{
2021-04-20 11:55:42 -04:00
if ( ( PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) && daNote . y < - daNote . height )
| | ( ! PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) && daNote . y > FlxG . height ) )
2020-10-04 02:42:58 -04:00
{
2020-10-05 14:24:51 -04:00
daNote . active = false ;
daNote . visible = false ;
}
e lse
{
daNote . visible = true ;
daNote . active = true ;
2020-10-04 02:42:58 -04:00
}
2021-03-30 21:02:12 -04:00
var strumLineMid = strumLine . y + Note . swagWidth / 2 ;
2021-12-06 22:35:14 -05:00
if ( daNote . followsTime )
2022-01-22 16:53:38 -05:00
daNote . y = ( Conductor . songPosition - daNote . data . strumTime ) * ( 0.45 * FlxMath . roundDecimal ( SongLoad . getSpeed ( ) ,
2 ) * daNote . noteSpeedMulti ) ;
2021-03-30 21:02:12 -04:00
2021-03-30 18:10:15 -04:00
if ( PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) )
2021-03-30 21:02:12 -04:00
{
2021-08-01 21:29:34 -04:00
daNote . y += strumLine . y ;
2021-03-31 13:11:05 -04:00
if ( daNote . isSustainNote )
2021-03-30 21:02:12 -04:00
{
2021-03-31 13:11:05 -04:00
if ( daNote . animation . curAnim . name . endsWith ( " e n d " ) && daNote . prevNote != null )
daNote . y += daNote . prevNote . height ;
e lse
2021-04-14 22:24:32 -04:00
daNote . y += daNote . height / 2 ;
2021-03-30 21:02:12 -04:00
2021-03-31 13:11:05 -04:00
if ( ( ! daNote . mustPress || ( daNote . wasGoodHit || ( daNote . prevNote . wasGoodHit && ! daNote . canBeHit ) ) )
2021-03-31 15:41:45 -04:00
& & daNote . y - daNote . offset . y * daNote . scale . y + daNote . height >= strumLineMid )
2021-03-31 13:11:05 -04:00
{
2021-08-01 21:29:34 -04:00
applyClipRect ( daNote ) ;
2021-03-31 13:11:05 -04:00
}
2021-03-30 21:02:12 -04:00
}
}
2021-03-30 18:10:15 -04:00
e lse
2021-03-30 21:02:12 -04:00
{
2021-12-06 22:35:14 -05:00
if ( daNote . followsTime )
daNote . y = strumLine . y - daNote . y ;
2021-03-31 00:25:41 -04:00
if ( daNote . isSustainNote
& & ( ! daNote . mustPress || ( daNote . wasGoodHit || ( daNote . prevNote . wasGoodHit && ! daNote . canBeHit ) ) )
2021-03-30 21:02:12 -04:00
& & daNote . y + daNote . offset . y * daNote . scale . y <= strumLineMid )
{
2021-08-01 21:29:34 -04:00
applyClipRect ( daNote ) ;
2021-03-30 21:02:12 -04:00
}
2021-02-13 17:39:31 -05:00
}
2020-10-05 14:24:51 -04:00
if ( ! daNote . mustPress && daNote . wasGoodHit )
{
2020-11-02 01:46:37 -05:00
if ( SONG . song != ' T u t o r i a l ' )
camZooming = true ;
2021-01-17 04:16:02 -05:00
var altAnim: String = " " ;
2021-12-06 17:49:05 -05:00
if ( SongLoad . getSong ( ) [ Math . floor ( curStep / 16 ) ] != null )
2021-01-17 04:16:02 -05:00
{
2021-12-06 17:49:05 -05:00
if ( SongLoad . getSong ( ) [ Math . floor ( curStep / 16 ) ] . altAnim )
2021-01-17 04:16:02 -05:00
altAnim = ' - a l t ' ;
}
2022-01-22 16:58:59 -05:00
if ( daNote . data . altNote )
2021-04-10 18:23:56 -04:00
altAnim = ' - a l t ' ;
2021-09-02 17:32:50 -04:00
if ( ! daNote . isSustainNote )
2020-10-05 14:24:51 -04:00
{
2022-02-09 20:31:36 -05:00
dad . playAnim ( ' s i n g ' + daNote . dirNameUpper + altAnim , true ) ;
2020-10-05 14:24:51 -04:00
}
2020-10-04 02:42:58 -04:00
2020-11-11 05:00:13 -05:00
dad . holdTimer = 0 ;
2020-10-30 19:47:19 -04:00
if ( SONG . needsVoices )
vocals . volume = 1 ;
2020-10-05 14:24:51 -04:00
daNote . kill ( ) ;
notes . remove ( daNote , true ) ;
daNote . destroy ( ) ;
}
2020-10-05 01:13:12 -04:00
2020-10-26 05:16:05 -04:00
// WIP interpolation shit? Need to fix the pause issue
2021-11-29 22:12:18 -05:00
// daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * SONG.speed[SongLoad.curDiff]));
2020-10-05 06:25:14 -04:00
2021-04-20 11:55:42 -04:00
// removing this so whether the note misses or not is entirely up to Note class
// var noteMiss:Bool = daNote.y < -daNote.height;
2021-03-30 18:10:15 -04:00
2021-04-20 11:55:42 -04:00
// if (PreferencesMenu.getPref('downscroll'))
2021-06-05 00:01:15 -04:00
// noteMiss = daNote.y > FlxG.height;
2021-03-30 18:10:15 -04:00
2021-04-20 16:25:38 -04:00
if ( daNote . isSustainNote && daNote . wasGoodHit )
{
if ( ( ! PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) && daNote . y < - daNote . height )
| | ( PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) && daNote . y > FlxG . height ) )
{
daNote . active = false ;
daNote . visible = false ;
daNote . kill ( ) ;
notes . remove ( daNote , true ) ;
daNote . destroy ( ) ;
}
}
e lse if ( daNote . tooLate || daNote . wasGoodHit )
2020-10-05 14:24:51 -04:00
{
2021-04-20 11:55:42 -04:00
if ( daNote . tooLate )
2020-10-05 18:29:59 -04:00
{
2021-09-22 16:04:34 -04:00
health -= 0.0775 ;
2021-02-19 19:22:23 -05:00
vocals . volume = 0 ;
2021-04-20 11:55:42 -04:00
killCombo ( ) ;
2020-10-05 18:29:59 -04:00
}
2020-10-05 06:25:14 -04:00
2021-02-19 19:22:23 -05:00
daNote . active = false ;
daNote . visible = false ;
2020-10-05 06:25:14 -04:00
2021-02-19 19:22:23 -05:00
daNote . kill ( ) ;
notes . remove ( daNote , true ) ;
daNote . destroy ( ) ;
2020-10-05 14:24:51 -04:00
}
} ) ;
}
2020-10-05 06:25:14 -04:00
2021-02-02 02:35:35 -05:00
if ( ! inCutscene )
keyShit ( ) ;
2020-10-03 13:36:39 -04:00
}
2021-08-01 21:29:34 -04:00
function applyClipRect ( daNote : Note ) : Void
{
// clipRect is applied to graphic itself so use frame Heights
var swagRect: FlxRect = new FlxRect ( 0 , 0 , daNote . frameWidth , daNote . frameHeight ) ;
var strumLineMid = strumLine . y + Note . swagWidth / 2 ;
if ( PreferencesMenu . getPref ( ' d o w n s c r o l l ' ) )
{
swagRect . height = ( strumLineMid - daNote . y ) / daNote . scale . y ;
swagRect . y = daNote . frameHeight - swagRect . height ;
}
e lse
{
swagRect . y = ( strumLineMid - daNote . y ) / daNote . scale . y ;
swagRect . height -= swagRect . y ;
}
daNote . clipRect = swagRect ;
}
2021-04-20 11:55:42 -04:00
function killCombo ( ) : Void
{
if ( combo > 5 && gf . animOffsets . exists ( ' s a d ' ) )
gf . playAnim ( ' s a d ' ) ;
2022-02-16 16:31:20 -05:00
2021-04-20 14:38:07 -04:00
if ( combo != 0 )
{
2022-02-16 16:31:20 -05:00
combo = comboPopUps . displayCombo ( 0 ) ;
2021-04-20 14:38:07 -04:00
}
2021-04-20 11:55:42 -04:00
}
2021-04-21 09:07:36 -04:00
#if debug
function changeSection ( sec : Int ) : Void
{
FlxG . sound . music . pause ( ) ;
var daBPM: Float = SONG . bpm ;
var daPos: Float = 0 ;
for ( i in 0 ... ( Std . int ( curStep / 16 + sec ) ) )
{
2021-12-06 17:49:05 -05:00
if ( SongLoad . getSong ( ) [ i ] . changeBPM )
2021-04-21 09:07:36 -04:00
{
2021-12-06 17:49:05 -05:00
daBPM = SongLoad . getSong ( ) [ i ] . bpm ;
2021-04-21 09:07:36 -04:00
}
daPos += 4 * ( 1000 * 60 / daBPM ) ;
}
Conductor . songPosition = FlxG . sound . music . time = daPos ;
2021-09-08 16:28:30 -04:00
Conductor . songPosition += Conductor . offset ;
2021-04-21 09:07:36 -04:00
updateCurStep ( ) ;
resyncVocals ( ) ;
}
#end
2020-10-31 21:11:14 -04:00
function endSong ( ) : Void
{
2021-04-09 16:37:54 -04:00
seenCutscene = false ;
2021-03-04 14:30:35 -05:00
deathCounter = 0 ;
2020-11-24 22:53:48 -05:00
canPause = false ;
2021-01-20 04:03:49 -05:00
FlxG . sound . music . volume = 0 ;
vocals . volume = 0 ;
2020-12-04 12:32:35 -05:00
if ( SONG . validScore )
{
Highscore . saveScore ( SONG . song , songScore , storyDifficulty ) ;
}
2020-11-01 04:55:02 -05:00
2020-10-31 21:11:14 -04:00
if ( isStoryMode )
{
2020-11-06 21:17:27 -05:00
campaignScore += songScore ;
2020-10-31 21:11:14 -04:00
storyPlaylist . remove ( storyPlaylist [ 0 ] ) ;
if ( storyPlaylist . length <= 0 )
{
2021-02-08 16:34:48 -05:00
FlxG . sound . playMusic ( Paths . music ( ' f r e a k y M e n u ' ) ) ;
2020-11-01 14:16:22 -05:00
2021-02-12 01:20:20 -05:00
transIn = FlxTransitionableState . defaultTransIn ;
transOut = FlxTransitionableState . defaultTransOut ;
2021-04-10 02:53:23 -04:00
switch ( PlayState . storyWeek )
{
c ase 7 :
FlxG . switchState ( new VideoState ( ) ) ;
d efault :
FlxG . switchState ( new StoryMenuState ( ) ) ;
}
2020-10-31 21:11:14 -04:00
2020-12-04 12:36:28 -05:00
// if ()
2020-12-11 17:22:22 -05:00
StoryMenuState . weekUnlocked [ Std . int ( Math . min ( storyWeek + 1 , StoryMenuState . weekUnlocked . length - 1 ) ) ] = true ;
2020-11-01 14:16:22 -05:00
2020-12-04 12:36:28 -05:00
if ( SONG . validScore )
{
NGio . unlockMedal ( 60961 ) ;
Highscore . saveWeekScore ( storyWeek , campaignScore , storyDifficulty ) ;
}
2020-11-01 04:55:02 -05:00
2020-11-01 14:16:22 -05:00
FlxG . save . data . weekUnlocked = StoryMenuState . weekUnlocked ;
FlxG . save . flush ( ) ;
2020-10-31 21:11:14 -04:00
}
e lse
{
var difficulty: String = " " ;
if ( storyDifficulty == 0 )
difficulty = ' - e a s y ' ;
if ( storyDifficulty == 2 )
2020-11-10 13:08:18 -05:00
difficulty = ' - h a r d ' ;
2020-10-31 21:11:14 -04:00
2020-11-07 16:59:25 -05:00
trace ( ' L O A D I N G N E X T S O N G ' ) ;
2021-04-10 01:49:57 -04:00
trace ( storyPlaylist [ 0 ] . toLowerCase ( ) + difficulty ) ;
2020-11-07 16:59:25 -05:00
2021-04-14 20:18:59 -04:00
FlxTransitionableState . skipNextTransIn = true ;
FlxTransitionableState . skipNextTransOut = true ;
FlxG . sound . music . stop ( ) ;
vocals . stop ( ) ;
2021-01-20 04:03:49 -05:00
if ( SONG . song . toLowerCase ( ) == ' e g g n o g ' )
{
var blackShit: FlxSprite = new FlxSprite ( - FlxG . width * FlxG . camera . zoom ,
- FlxG . height * FlxG . camera . zoom ) . makeGraphic ( FlxG . width * 3 , FlxG . height * 3 , FlxColor . BLACK ) ;
blackShit . scrollFactor . set ( ) ;
add ( blackShit ) ;
camHUD . visible = false ;
2021-04-14 20:18:59 -04:00
inCutscene = true ;
2021-01-20 04:03:49 -05:00
2021-04-18 05:26:52 -04:00
FlxG . sound . play ( Paths . sound ( ' L i g h t s _ S h u t _ o f f ' ) , function ( )
{
2021-04-14 20:18:59 -04:00
// no camFollow so it centers on horror tree
2021-11-29 21:43:38 -05:00
SONG = SongLoad . loadFromJson ( storyPlaylist [ 0 ] . toLowerCase ( ) + difficulty , storyPlaylist [ 0 ] ) ;
2021-04-14 20:18:59 -04:00
LoadingState . loadAndSwitchState ( new PlayState ( ) ) ;
} ) ;
2021-01-20 04:03:49 -05:00
}
2021-04-14 20:18:59 -04:00
e lse
{
prevCamFollow = camFollow ;
2021-01-20 04:03:49 -05:00
2021-11-29 21:43:38 -05:00
SONG = SongLoad . loadFromJson ( storyPlaylist [ 0 ] . toLowerCase ( ) + difficulty , storyPlaylist [ 0 ] ) ;
2021-04-14 20:18:59 -04:00
LoadingState . loadAndSwitchState ( new PlayState ( ) ) ;
}
2020-10-31 21:11:14 -04:00
}
}
e lse
{
2020-12-26 21:46:22 -05:00
trace ( ' W E N T B A C K T O F R E E P L A Y ? ? ' ) ;
2021-04-10 01:49:57 -04:00
// unloadAssets();
2020-10-31 21:11:14 -04:00
FlxG . switchState ( new FreeplayState ( ) ) ;
}
}
2021-04-20 14:38:07 -04:00
// gives score and pops up rating
2021-03-26 03:51:39 -04:00
private function popUpScore ( strumtime : Float , daNote : Note ) : Void
2020-10-03 15:32:15 -04:00
{
2020-10-18 20:59:53 -04:00
var noteDiff: Float = Math . abs ( strumtime - Conductor . songPosition ) ;
// boyfriend.playAnim('hey');
2020-10-30 19:47:19 -04:00
vocals . volume = 1 ;
2020-10-04 02:42:58 -04:00
2020-11-01 14:16:22 -05:00
var score: Int = 350 ;
2020-10-18 20:59:53 -04:00
var daRating: String = " s i c k " ;
2021-03-26 03:51:39 -04:00
var isSick: Bool = true ;
2021-09-22 15:09:32 -04:00
var healthMulti: Float = 1 ;
2022-02-09 20:31:36 -05:00
if ( daNote . lowStakes )
2021-09-22 15:09:32 -04:00
healthMulti *= 0.002 ;
2022-02-09 20:31:36 -05:00
e lse
healthMulti *= 0.033 ;
2021-09-22 15:09:32 -04:00
2021-09-08 13:28:11 -04:00
if ( noteDiff > Note . HIT_WINDOW * Note . BAD_THRESHOLD )
2020-10-18 20:59:53 -04:00
{
2021-09-22 15:09:32 -04:00
healthMulti *= 0 ; // no health on shit note
2020-10-18 20:59:53 -04:00
daRating = ' s h i t ' ;
2020-11-01 14:16:22 -05:00
score = 50 ;
2021-03-26 03:51:39 -04:00
isSick = false ; // shitty copypaste on this literally just because im lazy and tired lol!
2020-10-18 20:59:53 -04:00
}
2021-09-08 13:28:11 -04:00
e lse if ( noteDiff > Note . HIT_WINDOW * Note . GOOD_THRESHOLD )
2020-10-18 20:59:53 -04:00
{
2021-09-22 15:33:30 -04:00
healthMulti *= 0.2 ;
2021-09-22 15:09:32 -04:00
2020-10-05 10:03:38 -04:00
daRating = ' b a d ' ;
2020-11-01 14:16:22 -05:00
score = 100 ;
2021-03-26 03:51:39 -04:00
isSick = false ;
2020-10-18 20:59:53 -04:00
}
2021-09-08 13:28:11 -04:00
e lse if ( noteDiff > Note . HIT_WINDOW * Note . SICK_THRESHOLD )
2020-10-18 20:59:53 -04:00
{
2021-09-22 16:04:34 -04:00
healthMulti *= 0.78 ;
2021-09-22 15:09:32 -04:00
2020-10-18 20:59:53 -04:00
daRating = ' g o o d ' ;
2020-11-01 14:16:22 -05:00
score = 200 ;
2021-03-26 03:51:39 -04:00
isSick = false ;
}
2021-09-22 15:09:32 -04:00
health += healthMulti ;
2021-03-26 03:51:39 -04:00
if ( isSick )
{
2021-04-10 01:49:57 -04:00
var noteSplash: NoteSplash = grpNoteSplashes . recycle ( NoteSplash ) ;
2022-01-22 16:57:49 -05:00
noteSplash . setupNoteSplash ( daNote . x , daNote . y , daNote . data . noteData ) ;
2021-04-10 01:49:57 -04:00
// new NoteSplash(daNote.x, daNote.y, daNote.noteData);
grpNoteSplashes . add ( noteSplash ) ;
2020-10-18 20:59:53 -04:00
}
2021-04-09 22:49:25 -04:00
// Only add the score if you're not on practice mode
if ( ! practiceMode )
songScore += score ;
2020-11-01 14:16:22 -05:00
2022-02-16 16:31:20 -05:00
comboPopUps . displayRating ( daRating ) ;
2021-01-25 05:04:31 -05:00
2021-04-20 14:38:07 -04:00
if ( combo >= 10 || combo == 0 )
2022-02-16 16:31:20 -05:00
comboPopUps . displayCombo ( combo ) ;
2020-10-03 15:32:15 -04:00
}
2021-03-24 23:39:19 -04:00
var cameraRightSide: Bool = false ;
2021-03-24 22:41:41 -04:00
function cameraMovement ( )
{
2021-03-24 23:39:19 -04:00
if ( camFollow . x != dad . getMidpoint ( ) . x + 150 && ! cameraRightSide )
2021-03-24 22:41:41 -04:00
{
camFollow . setPosition ( dad . getMidpoint ( ) . x + 150 , dad . getMidpoint ( ) . y - 100 ) ;
// camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210);
switch ( dad . curCharacter )
{
c ase ' m o m ' :
camFollow . y = dad . getMidpoint ( ) . y ;
2021-04-14 21:56:42 -04:00
c ase ' s e n p a i ' | ' s e n p a i - a n g r y ' :
2021-03-24 22:41:41 -04:00
camFollow . y = dad . getMidpoint ( ) . y - 430 ;
camFollow . x = dad . getMidpoint ( ) . x - 100 ;
}
if ( dad . curCharacter == ' m o m ' )
vocals . volume = 1 ;
if ( SONG . song . toLowerCase ( ) == ' t u t o r i a l ' )
tweenCamIn ( ) ;
}
2021-03-24 23:39:19 -04:00
if ( cameraRightSide && camFollow . x != boyfriend . getMidpoint ( ) . x - 100 )
2021-03-24 22:41:41 -04:00
{
camFollow . setPosition ( boyfriend . getMidpoint ( ) . x - 100 , boyfriend . getMidpoint ( ) . y - 100 ) ;
switch ( curStage )
{
c ase ' l i m o ' :
camFollow . x = boyfriend . getMidpoint ( ) . x - 300 ;
c ase ' m a l l ' :
camFollow . y = boyfriend . getMidpoint ( ) . y - 200 ;
2021-04-21 22:17:00 -04:00
c ase ' s c h o o l ' | ' s c h o o l E v i l ' :
2021-03-24 22:41:41 -04:00
camFollow . x = boyfriend . getMidpoint ( ) . x - 200 ;
camFollow . y = boyfriend . getMidpoint ( ) . y - 200 ;
}
if ( SONG . song . toLowerCase ( ) == ' t u t o r i a l ' )
2021-08-21 20:45:03 -04:00
FlxTween . tween ( FlxG . camera , { zoom : 1 * FlxCamera . defaultZoom } , ( Conductor . stepCrochet * 4 / 1000 ) , { ease : FlxEase . elasticInOut } ) ;
2021-03-24 22:41:41 -04:00
}
}
2020-10-05 06:53:10 -04:00
private function keyShit ( ) : Void
2020-10-03 13:36:39 -04:00
{
2021-03-28 17:29:44 -04:00
// control arrays, order L D R U
var holdArray: Array < Bool > = [ controls . NOTE_LEFT , controls . NOTE_DOWN , controls . NOTE_UP , controls . NOTE_RIGHT ] ;
2021-03-30 16:58:05 -04:00
var pressArray: Array < Bool > = [
controls . NOTE_LEFT_P ,
controls . NOTE_DOWN_P ,
controls . NOTE_UP_P ,
controls . NOTE_RIGHT_P
] ;
var releaseArray: Array < Bool > = [
controls . NOTE_LEFT_R ,
controls . NOTE_DOWN_R ,
controls . NOTE_UP_R ,
controls . NOTE_RIGHT_R
] ;
2021-08-24 15:27:53 -04:00
/ *
2021-08-25 12:18:12 -04:00
var widHalf = FlxG . width / 2 ;
var heightHalf = FlxG . height / 2 ;
2021-08-24 15:27:53 -04:00
if ( FlxG . onMobile )
2021-08-22 10:37:06 -04:00
{
2021-08-24 15:27:53 -04:00
for ( touch in FlxG . touches . list )
2021-08-22 10:37:06 -04:00
{
2021-08-25 12:18:12 -04:00
var getHeight: Int = Math . floor ( touch . justPressedPosition . y / ( FlxG . height / 3 ) ) ;
var getWid: Int = Math . floor ( touch . justPressedPosition . x / ( FlxG . width / 4 ) ) ;
2021-08-24 15:27:53 -04:00
if ( touch . justPressed )
{
2021-08-25 12:18:12 -04:00
switch ( getWid )
2021-08-24 15:27:53 -04:00
{
c ase 1 :
2021-08-25 12:18:12 -04:00
pressArray [ 3 ] = true ;
2021-08-24 15:27:53 -04:00
c ase 2 :
2021-08-25 12:18:12 -04:00
pressArray [ 0 ] = true ;
d efault :
switch ( getHeight )
{
c ase 0 :
pressArray [ 2 ] = true ;
c ase 1 :
touch . justPressedPosition . x < widHalf ? pressArray [ 0 ] = true : pressArray [ 3 ] = true ;
c ase 2 :
pressArray [ 1 ] = true ;
}
2021-08-24 15:27:53 -04:00
}
}
2021-08-25 12:18:12 -04:00
switch ( getWid )
2021-08-22 10:37:06 -04:00
{
2021-08-22 16:54:22 -04:00
c ase 1 :
2021-08-25 12:18:12 -04:00
holdArray [ 3 ] = true ;
2021-08-22 16:54:22 -04:00
c ase 2 :
2021-08-25 12:18:12 -04:00
holdArray [ 0 ] = true ;
d efault :
switch ( getHeight )
{
c ase 0 :
holdArray [ 2 ] = true ;
c ase 1 :
touch . justPressedPosition . x < widHalf ? holdArray [ 0 ] = true : holdArray [ 3 ] = true ;
c ase 2 :
holdArray [ 1 ] = true ;
}
2021-08-22 10:37:06 -04:00
}
}
}
2021-08-24 15:27:53 -04:00
* /
2021-08-22 10:37:06 -04:00
2021-03-28 17:29:44 -04:00
// HOLDS, check for sustain notes
if ( holdArray . contains ( true ) && /*!boyfriend.stunned && */ generatedMusic )
2020-10-03 13:36:39 -04:00
{
2021-03-28 17:29:44 -04:00
notes . forEachAlive ( function ( daNote : Note )
{
2022-01-22 16:57:49 -05:00
if ( daNote . isSustainNote && daNote . canBeHit && daNote . mustPress && holdArray [ daNote . data . noteData ] )
2021-03-28 17:29:44 -04:00
goodNoteHit ( daNote ) ;
} ) ;
}
2021-03-21 16:29:47 -04:00
2021-03-28 17:29:44 -04:00
// PRESSES, check for note hits
if ( pressArray . contains ( true ) && /*!boyfriend.stunned && */ generatedMusic )
{
2021-08-22 16:54:22 -04:00
Haptic . vibrate ( 100 , 100 ) ;
2021-08-22 10:37:06 -04:00
2020-11-11 05:00:13 -05:00
boyfriend . holdTimer = 0 ;
2021-03-28 17:29:44 -04:00
var possibleNotes: Array < Note > = [ ] ; // notes that can be hit
var directionList: Array < Int > = [ ] ; // directions that can be hit
var dumbNotes: Array < Note > = [ ] ; // notes to kill later
2021-01-17 21:23:40 -05:00
2020-10-05 03:49:53 -04:00
notes . forEachAlive ( function ( daNote : Note )
2020-10-03 13:36:39 -04:00
{
2021-02-19 19:22:23 -05:00
if ( daNote . canBeHit && daNote . mustPress && ! daNote . tooLate && ! daNote . wasGoodHit )
2020-10-04 23:29:35 -04:00
{
2022-01-22 16:53:38 -05:00
if ( directionList . contains ( daNote . data . noteData ) )
2021-01-17 21:23:40 -05:00
{
2021-01-17 21:36:23 -05:00
for ( coolNote in possibleNotes )
2021-01-17 21:23:40 -05:00
{
2022-01-22 16:53:38 -05:00
if ( coolNote . data . noteData == daNote . data . noteData
& & Math . abs ( daNote . data . strumTime - coolNote . data . strumTime ) < 10 )
2021-03-30 16:58:05 -04:00
{ // if it's the same note twice at < 10ms distance, just delete it
2021-03-28 17:29:44 -04:00
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
dumbNotes . push ( daNote ) ;
break ;
}
2022-01-22 16:53:38 -05:00
e lse if ( coolNote . data . noteData == daNote . data . noteData && daNote . data . strumTime < coolNote . data . strumTime )
2021-03-30 16:58:05 -04:00
{ // if daNote is earlier than existing note (coolNote), replace
2021-03-28 17:29:44 -04:00
possibleNotes . remove ( coolNote ) ;
possibleNotes . push ( daNote ) ;
break ;
2021-01-17 21:36:23 -05:00
}
2021-01-17 21:23:40 -05:00
}
}
2021-01-19 21:09:47 -05:00
e lse
{
2021-03-28 17:29:44 -04:00
possibleNotes . push ( daNote ) ;
2022-01-22 16:53:38 -05:00
directionList . push ( daNote . data . noteData ) ;
2021-01-19 21:09:47 -05:00
}
2021-01-17 21:36:23 -05:00
}
2021-03-28 17:29:44 -04:00
} ) ;
2021-03-04 14:30:35 -05:00
2021-03-28 17:29:44 -04:00
for ( note in dumbNotes )
2020-10-04 23:29:35 -04:00
{
2022-01-22 16:53:38 -05:00
FlxG . log . add ( " k i l l i n g d u m b a s s n o t e a t " + note . data . strumTime ) ;
2021-03-28 17:29:44 -04:00
note . kill ( ) ;
notes . remove ( note , true ) ;
note . destroy ( ) ;
2020-10-04 23:29:35 -04:00
}
2020-10-04 17:44:52 -04:00
2022-01-22 16:53:38 -05:00
possibleNotes . sort ( ( a , b ) - > Std . int ( a . data . strumTime - b . data . strumTime ) ) ;
2021-03-28 17:29:44 -04:00
if ( perfectMode )
goodNoteHit ( possibleNotes [ 0 ] ) ;
e lse if ( possibleNotes . length > 0 )
2020-10-05 03:49:53 -04:00
{
2021-03-28 17:29:44 -04:00
for ( shit in 0 ... pressArray . length )
2021-03-30 16:58:05 -04:00
{ // if a direction is hit that shouldn't be
2021-03-28 17:29:44 -04:00
if ( pressArray [ shit ] && ! directionList . contains ( shit ) )
2021-04-20 11:55:42 -04:00
noteMiss ( shit ) ;
2021-03-28 17:29:44 -04:00
}
for ( coolNote in possibleNotes )
2020-10-05 03:49:53 -04:00
{
2022-01-22 16:53:38 -05:00
if ( pressArray [ coolNote . data . noteData ] )
2021-03-28 17:29:44 -04:00
goodNoteHit ( coolNote ) ;
2020-10-05 03:49:53 -04:00
}
2021-03-28 17:29:44 -04:00
}
e lse
{
2021-04-20 11:55:42 -04:00
for ( shit in 0 ... pressArray . length )
if ( pressArray [ shit ] )
noteMiss ( shit ) ;
2021-03-28 17:29:44 -04:00
}
2020-10-05 03:49:53 -04:00
}
2021-03-28 17:29:44 -04:00
if ( boyfriend . holdTimer > Conductor . stepCrochet * 4 * 0.001 && ! holdArray . contains ( true ) )
2020-10-23 19:12:38 -04:00
{
2020-11-11 05:00:13 -05:00
if ( boyfriend . animation . curAnim . name . startsWith ( ' s i n g ' ) && ! boyfriend . animation . curAnim . name . endsWith ( ' m i s s ' ) )
2020-10-23 19:12:38 -04:00
{
boyfriend . playAnim ( ' i d l e ' ) ;
}
}
2020-10-04 17:44:52 -04:00
playerStrums . forEach ( function ( spr : FlxSprite )
{
2021-03-28 17:29:44 -04:00
if ( pressArray [ spr . ID ] && spr . animation . curAnim . name != ' c o n f i r m ' )
spr . animation . play ( ' p r e s s e d ' ) ;
if ( ! holdArray [ spr . ID ] )
spr . animation . play ( ' s t a t i c ' ) ;
2020-10-05 06:53:10 -04:00
2021-02-02 00:48:22 -05:00
if ( spr . animation . curAnim . name == ' c o n f i r m ' && ! curStage . startsWith ( ' s c h o o l ' ) )
2020-10-04 17:44:52 -04:00
{
spr . centerOffsets ( ) ;
spr . offset . x -= 13 ;
spr . offset . y -= 13 ;
}
e lse
spr . centerOffsets ( ) ;
} ) ;
2020-10-03 13:36:39 -04:00
}
2021-06-08 23:05:38 -04:00
override function switchTo ( nextState : FlxState ) : Bool
{
openfl . utils . Assets . cache . clear ( Paths . inst ( SONG . song ) ) ;
openfl . utils . Assets . cache . clear ( Paths . voices ( SONG . song ) ) ;
return super . switchTo ( nextState ) ;
}
2022-02-09 20:31:36 -05:00
function noteMiss ( direction : NoteDir = 1 ) : Void
2020-10-04 23:29:35 -04:00
{
2021-04-20 11:55:42 -04:00
// whole function used to be encased in if (!boyfriend.stunned)
2021-09-22 16:04:34 -04:00
health -= 0.07 ;
2021-04-20 11:55:42 -04:00
killCombo ( ) ;
2020-10-05 10:03:38 -04:00
2021-04-20 11:55:42 -04:00
if ( ! practiceMode )
songScore -= 10 ;
2020-11-01 14:16:22 -05:00
2021-04-20 11:55:42 -04:00
vocals . volume = 0 ;
FlxG . sound . play ( Paths . soundRandom ( ' m i s s n o t e ' , 1 , 3 ) , FlxG . random . float ( 0.1 , 0.2 ) ) ;
2020-10-05 03:49:53 -04:00
2021-04-20 11:55:42 -04:00
/ * boyfriend . stunned = true ;
2020-10-04 23:29:35 -04:00
2021-06-05 00:01:15 -04:00
// get stunned for 5 seconds
new FlxTimer ( ) . start ( 5 / 60 , function ( tmr : FlxTimer )
{
boyfriend . stunned = false ;
} ) ; * /
2020-10-04 23:29:35 -04:00
2022-02-09 20:31:36 -05:00
boyfriend . playAnim ( ' s i n g ' + direction . nameUpper + ' m i s s ' , true ) ;
2020-10-04 23:29:35 -04:00
}
2021-04-20 11:55:42 -04:00
/ * not used anymore lol
2021-06-05 00:01:15 -04:00
function badNoteHit ( )
{
// just double pasting this shit cuz fuk u
// REDO THIS SYSTEM!
var leftP = controls . NOTE_LEFT_P ;
var downP = controls . NOTE_DOWN_P ;
var upP = controls . NOTE_UP_P ;
var rightP = controls . NOTE_RIGHT_P ;
if ( leftP )
noteMiss ( 0 ) ;
if ( downP )
noteMiss ( 1 ) ;
if ( upP )
noteMiss ( 2 ) ;
if ( rightP )
noteMiss ( 3 ) ;
} * /
2020-10-03 13:36:39 -04:00
function goodNoteHit ( note : Note ) : Void
{
2020-10-03 15:32:15 -04:00
if ( ! note . wasGoodHit )
{
2020-10-30 19:47:19 -04:00
if ( ! note . isSustainNote )
{
combo += 1 ;
2022-01-22 16:53:38 -05:00
popUpScore ( note . data . strumTime , note ) ;
2020-10-30 19:47:19 -04:00
}
2022-02-16 16:31:20 -05:00
2022-02-09 20:31:36 -05:00
boyfriend . playAnim ( ' s i n g ' + note . dirNameUpper , true ) ;
2020-10-04 02:42:58 -04:00
2020-10-04 14:50:12 -04:00
playerStrums . forEach ( function ( spr : FlxSprite )
{
2022-01-22 16:53:38 -05:00
if ( Math . abs ( note . data . noteData ) == spr . ID )
2020-10-04 14:50:12 -04:00
{
spr . animation . play ( ' c o n f i r m ' , true ) ;
}
} ) ;
2020-10-03 15:32:15 -04:00
note . wasGoodHit = true ;
2020-10-04 02:42:58 -04:00
vocals . volume = 1 ;
2020-10-05 18:29:59 -04:00
2021-02-13 17:39:31 -05:00
if ( ! note . isSustainNote )
{
note . kill ( ) ;
notes . remove ( note , true ) ;
note . destroy ( ) ;
}
2020-10-03 15:32:15 -04:00
}
2020-10-03 02:50:15 -04:00
}
2021-09-24 11:51:15 -04:00
function resetCamFollow ( ) : Void
{
FlxG . camera . follow ( camFollow , LOCKON , 0.04 ) ;
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
FlxG . camera . zoom = defaultCamZoom ;
FlxG . camera . focusOn ( camFollow . getPosition ( ) ) ;
}
2020-12-27 05:37:04 -05:00
var fastCarCanDrive: Bool = true ;
function resetFastCar ( ) : Void
{
fastCar . x = - 12600 ;
fastCar . y = FlxG . random . int ( 140 , 250 ) ;
fastCar . velocity . x = 0 ;
fastCarCanDrive = true ;
}
function fastCarDrive ( )
{
2021-02-08 16:34:48 -05:00
FlxG . sound . play ( Paths . soundRandom ( ' c a r P a s s ' , 0 , 1 ) , 0.7 ) ;
2020-12-27 05:37:04 -05:00
fastCar . velocity . x = ( FlxG . random . int ( 170 , 220 ) / FlxG . elapsed ) * 3 ;
fastCarCanDrive = false ;
new FlxTimer ( ) . start ( 2 , function ( tmr : FlxTimer )
{
resetFastCar ( ) ;
} ) ;
}
2021-04-18 03:35:43 -04:00
function moveTank ( ) : Void
{
2021-04-18 05:25:44 -04:00
if ( ! inCutscene )
{
var daAngleOffset: Float = 1 ;
tankAngle += FlxG . elapsed * tankSpeed ;
tankGround . angle = tankAngle - 90 + 15 ;
2021-04-18 03:35:43 -04:00
2021-04-18 05:25:44 -04:00
tankGround . x = tankX + Math . cos ( FlxAngle . asRadians ( ( tankAngle * daAngleOffset ) + 180 ) ) * 1500 ;
tankGround . y = 1300 + Math . sin ( FlxAngle . asRadians ( ( tankAngle * daAngleOffset ) + 180 ) ) * 1100 ;
}
2021-04-18 03:35:43 -04:00
}
var tankResetShit: Bool = false ;
var tankMoving: Bool = false ;
var tankAngle: Float = FlxG . random . int ( - 90 , 45 ) ;
var tankSpeed: Float = FlxG . random . float ( 5 , 7 ) ;
var tankX: Float = 400 ;
2020-12-10 18:23:53 -05:00
var trainMoving: Bool = false ;
var trainFrameTiming: Float = 0 ;
var trainCars: Int = 8 ;
var trainFinishing: Bool = false ;
2020-12-11 08:08:41 -05:00
var trainCooldown: Int = 0 ;
2020-12-10 18:23:53 -05:00
function trainStart ( ) : Void
{
trainMoving = true ;
2021-03-14 15:48:02 -04:00
trainSound . play ( true ) ;
2020-12-10 18:23:53 -05:00
}
var startedMoving: Bool = false ;
function updateTrainPos ( ) : Void
{
if ( trainSound . time >= 4700 )
{
startedMoving = true ;
2020-12-11 07:55:39 -05:00
gf . playAnim ( ' h a i r B l o w ' ) ;
2020-12-10 18:23:53 -05:00
}
if ( startedMoving )
{
phillyTrain . x -= 400 ;
if ( phillyTrain . x < - 2000 && ! trainFinishing )
{
phillyTrain . x = - 1150 ;
trainCars -= 1 ;
if ( trainCars <= 0 )
trainFinishing = true ;
}
2020-12-11 04:15:24 -05:00
if ( phillyTrain . x < - 4000 && trainFinishing )
2020-12-10 18:23:53 -05:00
trainReset ( ) ;
}
}
function trainReset ( ) : Void
{
2020-12-11 07:55:39 -05:00
gf . playAnim ( ' h a i r F a l l ' ) ;
2020-12-10 18:23:53 -05:00
phillyTrain . x = FlxG . width + 200 ;
trainMoving = false ;
// trainSound.stop();
// trainSound.time = 0;
trainCars = 8 ;
2020-12-11 00:57:42 -05:00
trainFinishing = false ;
2020-12-10 18:23:53 -05:00
startedMoving = false ;
}
2020-11-02 01:46:37 -05:00
function lightningStrikeShit ( ) : Void
{
2021-02-08 16:34:48 -05:00
FlxG . sound . play ( Paths . soundRandom ( ' t h u n d e r _ ' , 1 , 2 ) ) ;
2020-11-02 01:46:37 -05:00
halloweenBG . animation . play ( ' l i g h t n i n g ' ) ;
lightningStrikeBeat = curBeat ;
lightningOffset = FlxG . random . int ( 8 , 24 ) ;
boyfriend . playAnim ( ' s c a r e d ' , true ) ;
gf . playAnim ( ' s c a r e d ' , true ) ;
}
2020-10-09 23:22:07 -04:00
override function stepHit ( )
{
2021-02-11 21:19:27 -05:00
super . stepHit ( ) ;
2021-04-18 16:54:21 -04:00
if ( Math . abs ( FlxG . sound . music . time - ( Conductor . songPosition - Conductor . offset ) ) > 20
| | ( SONG . needsVoices && Math . abs ( vocals . time - ( Conductor . songPosition - Conductor . offset ) ) > 20 ) )
2020-10-09 23:22:07 -04:00
{
2021-02-08 12:47:15 -05:00
resyncVocals ( ) ;
2020-10-30 19:47:19 -04:00
}
2020-10-09 23:22:07 -04:00
}
2020-11-02 01:46:37 -05:00
var lightningStrikeBeat: Int = 0 ;
var lightningOffset: Int = 8 ;
2020-10-09 22:39:52 -04:00
override function beatHit ( )
2020-10-03 02:50:15 -04:00
{
2020-10-09 22:39:52 -04:00
super . beatHit ( ) ;
2020-10-05 05:48:30 -04:00
2020-10-24 05:19:13 -04:00
if ( generatedMusic )
{
2021-04-01 22:28:20 -04:00
notes . sort ( sortNotes , FlxSort . DESCENDING ) ;
2020-10-24 05:19:13 -04:00
}
2021-12-06 17:49:05 -05:00
if ( SongLoad . getSong ( ) [ Math . floor ( curStep / 16 ) ] != null )
2020-10-30 19:47:19 -04:00
{
2021-12-06 17:49:05 -05:00
if ( SongLoad . getSong ( ) [ Math . floor ( curStep / 16 ) ] . changeBPM )
2020-10-31 21:11:14 -04:00
{
2021-12-06 17:49:05 -05:00
Conductor . changeBPM ( SongLoad . getSong ( ) [ Math . floor ( curStep / 16 ) ] . bpm ) ;
2020-10-31 21:11:14 -04:00
FlxG . log . add ( ' C H A N G E D B P M ! ' ) ;
}
2021-02-12 01:20:20 -05:00
// else
// Conductor.changeBPM(SONG.bpm);
2020-10-30 19:47:19 -04:00
}
2021-11-29 22:12:18 -05:00
// FlxG.log.add('change bpm' + SONG.notes[SongLoad.curDiff][Std.int(curStep / 16)].changeBPM);
2020-10-30 19:47:19 -04:00
2020-12-22 20:55:03 -05:00
// HARDCODING FOR MILF ZOOMS!
2021-03-26 21:28:04 -04:00
if ( PreferencesMenu . getPref ( ' c a m e r a - z o o m ' ) )
2020-11-02 01:46:37 -05:00
{
2021-03-26 21:28:04 -04:00
if ( curSong . toLowerCase ( ) == ' m i l f ' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG . camera . zoom < 1.35 )
{
2021-08-21 20:45:03 -04:00
FlxG . camera . zoom += 0.015 * FlxCamera . defaultZoom ;
2021-03-26 21:28:04 -04:00
camHUD . zoom += 0.03 ;
}
2021-08-21 20:45:03 -04:00
if ( camZooming && FlxG . camera . zoom < ( 1.35 * FlxCamera . defaultZoom ) && curBeat % 4 == 0 )
2021-03-26 21:28:04 -04:00
{
2021-08-21 20:45:03 -04:00
FlxG . camera . zoom += 0.015 * FlxCamera . defaultZoom ;
2021-03-26 21:28:04 -04:00
camHUD . zoom += 0.03 ;
}
2020-11-02 01:46:37 -05:00
}
2020-10-03 13:36:39 -04:00
2020-12-24 18:24:11 -05:00
iconP1 . setGraphicSize ( Std . int ( iconP1 . width + 30 ) ) ;
iconP2 . setGraphicSize ( Std . int ( iconP2 . width + 30 ) ) ;
iconP1 . updateHitbox ( ) ;
iconP2 . updateHitbox ( ) ;
2020-10-05 08:55:39 -04:00
2022-02-04 11:58:24 -05:00
var song = SongLoad . getSong ( ) ;
var step = Math . floor ( curStep / 16 ) ;
2021-07-14 20:32:09 -04:00
if ( curBeat % 8 == 7
2022-02-04 11:58:24 -05:00
& & song [ step ] . mustHitSection
2021-07-14 20:32:09 -04:00
& & combo > 5
2022-02-16 16:31:20 -05:00
& & song . length > step + 1 // GK: this fixes an error on week 1 where song[step + 1] was null
2022-02-04 11:58:24 -05:00
& & ! song [ step + 1 ] . mustHitSection )
2021-07-14 20:32:09 -04:00
{
var animShit: ComboCounter = new ComboCounter ( - 100 , 300 , combo ) ;
2021-07-15 18:22:15 -04:00
animShit . scrollFactor . set ( 0.6 , 0.6 ) ;
2021-09-08 20:01:55 -04:00
// add(animShit);
2021-07-15 18:22:15 -04:00
var frameShit: Float = ( 1 / 24 ) * 2 ; // equals 2 frames in the animation
new FlxTimer ( ) . start ( ( ( Conductor . crochet / 1000 ) * 1.25 ) - frameShit , function ( tmr )
{
animShit . forceFinish ( ) ;
} ) ;
2021-07-14 20:32:09 -04:00
}
2021-02-11 21:19:27 -05:00
if ( curBeat % gfSpeed == 0 )
2020-10-09 22:39:52 -04:00
gf . dance ( ) ;
2020-10-04 02:42:58 -04:00
2021-03-14 15:46:44 -04:00
if ( curBeat % 2 == 0 )
2021-01-20 01:38:39 -05:00
{
2021-03-14 15:46:44 -04:00
if ( ! boyfriend . animation . curAnim . name . startsWith ( " s i n g " ) )
boyfriend . playAnim ( ' i d l e ' ) ;
if ( ! dad . animation . curAnim . name . startsWith ( " s i n g " ) )
dad . dance ( ) ;
}
e lse if ( dad . curCharacter == ' s p o o k y ' )
{
if ( ! dad . animation . curAnim . name . startsWith ( " s i n g " ) )
dad . dance ( ) ;
2021-01-20 01:38:39 -05:00
}
2020-10-30 19:47:19 -04:00
2021-02-11 21:19:27 -05:00
if ( curBeat % 8 == 7 && curSong == ' B o p e e b o ' )
2020-10-30 19:47:19 -04:00
{
boyfriend . playAnim ( ' h e y ' , true ) ;
2021-02-26 18:43:20 -05:00
}
2020-10-30 19:47:19 -04:00
2021-02-26 18:43:20 -05:00
if ( curBeat % 16 == 15 && SONG . song == ' T u t o r i a l ' && dad . curCharacter == ' g f ' && curBeat > 16 && curBeat < 48 )
{
boyfriend . playAnim ( ' h e y ' , true ) ;
dad . playAnim ( ' c h e e r ' , true ) ;
2020-10-30 19:47:19 -04:00
}
2020-11-02 01:46:37 -05:00
2021-03-08 18:38:58 -05:00
foregroundSprites . forEach ( function ( spr : BGSprite )
{
spr . dance ( ) ;
} ) ;
2021-04-21 22:17:00 -04:00
// boppin friends
2020-12-10 18:23:53 -05:00
switch ( curStage )
{
2021-01-25 05:04:31 -05:00
c ase ' s c h o o l ' :
bgGirls . dance ( ) ;
2021-01-19 21:09:47 -05:00
c ase ' m a l l ' :
upperBoppers . animation . play ( ' b o p ' , true ) ;
bottomBoppers . animation . play ( ' b o p ' , true ) ;
2021-01-19 23:29:18 -05:00
santa . animation . play ( ' i d l e ' , true ) ;
2021-01-19 21:09:47 -05:00
2020-12-27 03:13:51 -05:00
c ase ' l i m o ' :
grpLimoDancers . forEach ( function ( dancer : BackgroundDancer )
{
dancer . dance ( ) ;
} ) ;
2020-12-27 05:37:04 -05:00
if ( FlxG . random . bool ( 10 ) && fastCarCanDrive )
fastCarDrive ( ) ;
2020-12-10 18:23:53 -05:00
c ase " p h i l l y " :
2020-12-11 08:08:41 -05:00
if ( ! trainMoving )
trainCooldown += 1 ;
2021-02-11 21:19:27 -05:00
if ( curBeat % 4 == 0 )
2020-12-10 18:23:53 -05:00
{
2021-04-18 01:43:28 -04:00
lightFadeShader . reset ( ) ;
2020-12-10 18:23:53 -05:00
phillyCityLights . forEach ( function ( light : FlxSprite )
{
light . visible = false ;
} ) ;
curLight = FlxG . random . int ( 0 , phillyCityLights . length - 1 ) ;
phillyCityLights . members [ curLight ] . visible = true ;
2020-12-13 01:08:21 -05:00
// phillyCityLights.members[curLight].alpha = 1;
2020-12-10 18:23:53 -05:00
}
2021-02-11 21:19:27 -05:00
if ( curBeat % 8 == 4 && FlxG . random . bool ( 30 ) && ! trainMoving && trainCooldown > 8 )
2020-12-10 18:23:53 -05:00
{
2020-12-11 08:08:41 -05:00
trainCooldown = FlxG . random . int ( - 4 , 0 ) ;
2020-12-10 18:23:53 -05:00
trainStart ( ) ;
}
2021-04-08 21:52:21 -04:00
c ase ' t a n k ' :
tankWatchtower . dance ( ) ;
2020-12-10 18:23:53 -05:00
}
2020-11-02 01:46:37 -05:00
if ( isHalloween && FlxG . random . bool ( 10 ) && curBeat > lightningStrikeBeat + lightningOffset )
{
lightningStrikeShit ( ) ;
}
2020-10-03 02:50:15 -04:00
}
2020-12-10 18:23:53 -05:00
var curLight: Int = 0 ;
2020-10-03 02:50:15 -04:00
}
2021-08-27 18:08:01 -04:00
typedef StageData =
{
var camZoom: Float ;
var propsBackground: Array < Props > ;
}
typedef Props =
{
var x: Float ;
var y: Float ;
var scrollX: Float ;
var scrollY: Float ;
var propname: String ;
var path: String ;
var scaleX: Float ;
var scaleY: Float ;
2021-08-28 12:41:15 -04:00
var ? animBullshit: PropAnimData ;
2021-08-28 13:01:17 -04:00
var ? updateHitbox: Bool ;
var ? antialiasing: Bool ;
2021-08-28 12:41:15 -04:00
}
typedef PropAnimData =
{
var isLooping: Bool ;
var anims: Array < String > ;
2021-08-27 18:08:01 -04:00
}