Skip to content

Commit 683bf9b

Browse files
committed
Merge branch 'AP-CustomEx' of https://github.com/Z11Coding/Mixtape-Engine-Rework into AP-CustomEx
2 parents e76a9ba + 7395de9 commit 683bf9b

File tree

3 files changed

+298
-250
lines changed

3 files changed

+298
-250
lines changed

source/stages/PhillyTrainErect.hx

Lines changed: 10 additions & 249 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import flxanimate.motion.AdjustColor;
66
import objects.Character;
77
import shaders.AdjustColorShader;
88
import stages.PicoCapableStage;
9+
import stages.cutscenes.TwoPicos;
910
import stages.objects.PhillyLights;
1011
import stages.objects.PhillyTrain;
1112
import stages.objects.PicoDopplegangerSprite;
@@ -18,6 +19,8 @@ class PhillyTrainErect extends BaseStage
1819
var phillyTrain:PhillyTrain;
1920
var curLight:Int = -1;
2021

22+
var cutsceneObj:TwoPicos;
23+
2124
var curLightEvent:Int = -1;
2225
var colorShader:AdjustColorShader;
2326

@@ -54,9 +57,10 @@ class PhillyTrainErect extends BaseStage
5457
add(phillyStreet);
5558

5659

57-
if(!seenCutscene
58-
&& PlayState.SONG.player1 == "pico-playable"
59-
&& PlayState.SONG.player2 == "pico") setStartCallback(ughIntro);
60+
if (!seenCutscene && PlayState.SONG.player1 == "pico-playable" && PlayState.SONG.player2 == "pico"){
61+
cutsceneObj = new TwoPicos(this, colorShader);
62+
setStartCallback(cutsceneObj.startCutscene);
63+
}
6064

6165
new PhillyLights(phillyStreet,phillyWindow.x,phillyWindow.y,phillyLightsColors);
6266
}
@@ -99,9 +103,9 @@ class PhillyTrainErect extends BaseStage
99103
super.update(elapsed);
100104
}
101105

102-
override function startSong() {
103-
cutsceneHandler?.destroy();
104-
}
106+
// override function startSong() {
107+
// cutsceneHandler?.destroy();
108+
// }
105109

106110
override function beatHit()
107111
{
@@ -132,247 +136,4 @@ class PhillyTrainErect extends BaseStage
132136

133137
FlxG.camera.flash(color, 0.15, null, true);
134138
}
135-
136-
// Cutscenes
137-
var cutsceneHandler:CutsceneHandler;
138-
var imposterPico:PicoDopplegangerSprite;
139-
var pico:PicoDopplegangerSprite;
140-
var bloodPool:FlxAnimate;
141-
var cigarette:FlxSprite;
142-
var audioPlaying:FlxSound;
143-
144-
var playerShoots:Bool;
145-
var explode:Bool;
146-
var seenOutcome:Bool;
147-
148-
function prepareCutscene()
149-
{
150-
cutsceneHandler = new CutsceneHandler();
151-
152-
boyfriend.visible = dad.visible = false;
153-
camHUD.visible = false;
154-
// inCutscene = true; //this would stop the camera movement, oops
155-
156-
imposterPico = new PicoDopplegangerSprite(dad.x + 82, dad.y + 400);
157-
imposterPico.showPivot = false;
158-
imposterPico.antialiasing = ClientPrefs.data.antialiasing;
159-
cutsceneHandler.push(imposterPico);
160-
161-
pico = new PicoDopplegangerSprite(boyfriend.x + 48.5, boyfriend.y + 400);
162-
pico.showPivot = false;
163-
pico.antialiasing = ClientPrefs.data.antialiasing;
164-
cutsceneHandler.push(pico);
165-
166-
bloodPool = new FlxAnimate(0, 0);
167-
bloodPool.visible = false;
168-
Paths.loadAnimateAtlas(bloodPool, "philly/erect/cutscenes/bloodPool");
169-
170-
cigarette = new FlxSprite();
171-
cigarette.frames = Paths.getSparrowAtlas('philly/erect/cutscenes/cigarette');
172-
cigarette.animation.addByPrefix('cigarette spit', 'cigarette spit', 24, false);
173-
cigarette.visible = false;
174-
175-
cutsceneHandler.finishCallback = function()
176-
{
177-
seenCutscene = true;
178-
//Restore camera
179-
var timeForStuff:Float = Conductor.crochet / 1000 * 4.5;
180-
FlxG.sound.music.fadeOut(timeForStuff);
181-
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, timeForStuff, {ease: FlxEase.quadInOut});
182-
183-
//Show still alive chars
184-
if (explode)
185-
{
186-
if (playerShoots) boyfriend.visible = true;
187-
else dad.visible = true;
188-
}
189-
else boyfriend.visible = dad.visible = true;
190-
191-
camHUD.visible = true;
192-
193-
//Crear callbacks
194-
boyfriend.animation.finishCallback = null;
195-
gf.animation.finishCallback = null;
196-
197-
if (audioPlaying != null) audioPlaying.stop();
198-
pico.cancelSounds();
199-
imposterPico.cancelSounds();
200-
201-
if (explode)
202-
{
203-
if(playerShoots){
204-
if (seenOutcome)
205-
imposterPico.playAnimation("loopOpponent", true, true, true);
206-
else
207-
{
208-
imposterPico.kill();
209-
game.remove(imposterPico);
210-
imposterPico.destroy();
211-
dad.visible = true;
212-
}
213-
}
214-
else{
215-
216-
if(seenOutcome){
217-
pico.playAnimation("loopPlayer", true, true, true);
218-
endSong();
219-
}
220-
else{
221-
pico.kill();
222-
game.remove(pico);
223-
pico.destroy();
224-
boyfriend.visible = true;
225-
}
226-
}
227-
if(seenOutcome && playerShoots){
228-
game.camZooming = true;
229-
game.opponentVocals = new FlxSound();
230-
for (note in game.unspawnNotes){
231-
if (!note.mustPress && note.eventName == "")
232-
{
233-
note.ignoreNote = true;
234-
}
235-
}
236-
}
237-
}
238-
//Dance!
239-
dad.dance();
240-
boyfriend.dance();
241-
gf.dance();
242-
243-
FlxTween.cancelTweensOf(FlxG.camera);
244-
FlxTween.cancelTweensOf(camFollow);
245-
@:privateAccess
246-
game.moveCameraSection();
247-
FlxG.camera.scroll.set(camFollow.x - FlxG.width / 2, camFollow.y - FlxG.height / 2);
248-
FlxG.camera.zoom = defaultCamZoom;
249-
if(!explode || playerShoots) startCountdown();
250-
};
251-
cutsceneHandler.skipCallback = function()
252-
{
253-
cutsceneHandler.finishCallback();
254-
};
255-
camFollow_set(dad.x + 280, dad.y + 170);
256-
}
257-
258-
function ughIntro()
259-
{
260-
prepareCutscene();
261-
seenOutcome = false;
262-
// 50/50 chance for who shoots
263-
if (FlxG.random.bool(50))
264-
{
265-
playerShoots = true;
266-
}
267-
else
268-
{
269-
playerShoots = false;
270-
}
271-
if (FlxG.random.bool(8))
272-
{
273-
explode = true;
274-
}
275-
else
276-
{
277-
explode = false;
278-
}
279-
cutsceneHandler.endTime = 13;
280-
cutsceneHandler.music = playerShoots ? 'cutscene/cutscene2' : 'cutscene/cutscene';
281-
Paths.sound('cutscene/picoCigarette');
282-
Paths.sound('cutscene/picoExplode');
283-
Paths.sound('cutscene/picoShoot');
284-
Paths.sound('cutscene/picoSpin');
285-
Paths.sound('cutscene/picoCigarette2');
286-
Paths.sound('cutscene/picoGasp');
287-
288-
var cigarettePos:Array<Float> = [];
289-
var shooterPos:Array<Float> = [];
290-
if (playerShoots == true)
291-
{
292-
cigarette.flipX = true;
293-
294-
addBehindBF(cigarette);
295-
addBehindBF(bloodPool);
296-
addBehindBF(imposterPico);
297-
addBehindBF(pico);
298-
299-
cigarette.setPosition(boyfriend.x - 143.5, boyfriend.y + 210);
300-
bloodPool.setPosition(dad.x - 1487, dad.y - 173);
301-
302-
shooterPos = cameraPos(boyfriend, game.boyfriendCameraOffset);
303-
cigarettePos = cameraPos(dad, [250, 0]);
304-
}
305-
else
306-
{
307-
addBehindDad(cigarette);
308-
addBehindDad(bloodPool);
309-
addBehindDad(pico);
310-
addBehindDad(imposterPico);
311-
bloodPool.setPosition(boyfriend.x - 788.5, boyfriend.y - 173);
312-
cigarette.setPosition(boyfriend.x - 478.5, boyfriend.y + 205);
313-
314-
cigarettePos = cameraPos(boyfriend, game.boyfriendCameraOffset);
315-
shooterPos = cameraPos(dad, [250, 0]);
316-
}
317-
var midPoint:Array<Float> = [(shooterPos[0] + cigarettePos[0]) / 2, (shooterPos[1] + cigarettePos[1]) / 2];
318-
319-
// Allw picos to set their cutscene timers
320-
imposterPico.doAnim("Opponent", !playerShoots, explode, cutsceneHandler);
321-
pico.doAnim("Player", playerShoots, explode, cutsceneHandler);
322-
323-
camFollow_set(midPoint[0], midPoint[1]);
324-
325-
if (ClientPrefs.data.shaders)
326-
{
327-
cutsceneHandler.timer(0.01, () ->
328-
{
329-
pico.shader = colorShader;
330-
imposterPico.shader = colorShader;
331-
bloodPool.shader = colorShader;
332-
});
333-
}
334-
335-
cutsceneHandler.timer(4, () ->
336-
{
337-
camFollow_set(cigarettePos[0], cigarettePos[1]);
338-
});
339-
340-
cutsceneHandler.timer(6.3, () ->
341-
{
342-
camFollow_set(shooterPos[0], shooterPos[1]);
343-
});
344-
345-
cutsceneHandler.timer(8.75, () ->
346-
{
347-
seenOutcome = true;
348-
// cutting off skipping here. really dont think its needed after this point and it saves problems from happening
349-
camFollow_set(cigarettePos[0], cigarettePos[1]);
350-
});
351-
352-
cutsceneHandler.timer(11.2, () ->
353-
{
354-
if (explode == true)
355-
{
356-
bloodPool.visible = true;
357-
bloodPool.anim.play("bloodPool", true);
358-
}
359-
});
360-
361-
cutsceneHandler.timer(11.5, () ->
362-
{
363-
if (explode == false)
364-
{
365-
cigarette.visible = true;
366-
cigarette.animation.play('cigarette spit');
367-
}
368-
});
369-
}
370-
371-
function cameraPos(char:Character, camOffset:Array<Float>)
372-
{
373-
var point = new FlxPoint(char.getMidpoint().x - 100, char.getMidpoint().y - 100);
374-
point.x -= char.cameraPosition[0] - camOffset[0];
375-
point.y += char.cameraPosition[1] + camOffset[1];
376-
return [point.x, point.y];
377-
}
378139
}

0 commit comments

Comments
 (0)