Skip to content

Commit be2ce5d

Browse files
committed
yep
1 parent 9314203 commit be2ce5d

File tree

7 files changed

+82
-59
lines changed

7 files changed

+82
-59
lines changed
28.7 KB
Binary file not shown.
8.67 KB
Binary file not shown.

source/archipelago/APItem.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ class APItem {
536536
case "Input Sequence Trap":
537537
return new APTrap(name, ConditionHelper.PlayState(), function() {
538538
popup('Imma hit you with a QTE just cause.', "TrapLink: Input Sequence Trap");
539-
TrapLinkFunctions.doBushwakThings(true);
539+
TrapLinkFunctions.doBushwakThings();
540540
}, true, true).funcAndReturn(function(t:APItem) {
541541
// Set it as a trap.
542542
t.isTrap = true;

source/archipelago/Trampoline.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
package archipelago;
22

33
class Trampoline extends FlxSprite {
44
// TRAMPOLINE SCRIPT!!!

source/archipelago/TrapLinkFunctions.hx

Lines changed: 66 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package archipelago;
22

33
import objects.charting.ChartingStrumNote as StrumNote;
4+
import objects.Note;
5+
import openfl.events.KeyboardEvent;
6+
import flixel.input.keyboard.FlxKey;
7+
import archipelago.substates.UnownSubState;
48

59
class TrapLinkFunctions {
610
static var bfPosition:Array<Float>;
@@ -53,37 +57,41 @@ class TrapLinkFunctions {
5357
}
5458

5559
static var daCoolTween:FlxTween;
56-
static var grpNotes:FlxTween;
57-
static var randArray:FlxTween;
60+
static var grpNotes:Array<StrumNote>;
61+
static var randArray:Array<Int>;
62+
public static var keysArray:Array<Array<Dynamic>>; //Specifically for this one thing
5863
public static function doBushwakThings(?length:Int = 4) {
64+
if (keysArray == null)
65+
keysArray = backend.Keybinds.fill();
66+
5967
randArray = [for (i in 0...length) FlxG.random.int(0, 3)];
6068

61-
for (i in grpNotes) { i.kill(); APPlatState.instance.remove(i); i.destroy(); }
69+
for (i in grpNotes) { i.kill(); APPlayState.instance.remove(i); i.destroy(); }
6270

6371
grpNotes = [];
6472

6573
var colArray = ['purple', 'blue', 'green', 'red'];
6674

6775
for (i in 0...randArray.length) {
68-
cool = new StrumNote(0, 0, randArray[i], 0);
69-
if (!APPlatState.instance.isPixelStage) cool.animation.addByPrefix('color', colArray[cool.noteData] + '0', 24, true);
76+
var cool:StrumNote = new StrumNote(0, 0, randArray[i], 0);
77+
if (!PlayState.isPixelStage) cool.animation.addByPrefix('color', colArray[cool.noteData] + '0', 24, true);
7078
cool.playAnim('static');
7179
cool.ID = i;
7280
cool.scrollFactor.set(1, 1);
73-
cool.x = APPlatState.instance.boyfriend.x + (APPlatState.instance.boyfriend.width / 2) - ((Note.swagWidth * randArray.length) / 2);
81+
cool.x = APPlayState.instance.boyfriend.x + (APPlayState.instance.boyfriend.width / 2) - ((Note.swagWidth * randArray.length) / 2);
7482
cool.x += Note.swagWidth * i;
75-
cool.y = APPlatState.instance.boyfriend.y - Note.swagWidth - 5;
76-
APPlatState.instance.add(cool);
83+
cool.y = APPlayState.instance.boyfriend.y - Note.swagWidth - 5;
84+
APPlayState.instance.add(cool);
7785
grpNotes[i] = cool;
7886
}
7987

8088
var tag = 'ajgnaidngkjsfohijaoihjpdafgnadjoiashmfmhiobad';
8189

8290
daCoolTween = FlxTween.num(6.1, 0, 2, { ease: FlxEase.expoOut}, function(num) {
8391
for (j in grpNotes) {
84-
j.x = APPlatState.instance.boyfriend.x + (APPlatState.instance.boyfriend.width / 2) - ((Note.swagWidth * randArray.length) / 2);
92+
j.x = APPlayState.instance.boyfriend.x + (APPlayState.instance.boyfriend.width / 2) - ((Note.swagWidth * randArray.length) / 2);
8593
j.x += Note.swagWidth * j.ID;
86-
j.y = APPlatState.instance.boyfriend.y - Note.swagWidth - 5;
94+
j.y = APPlayState.instance.boyfriend.y - Note.swagWidth - 5;
8795
j.x += FlxG.random.float(-num, num);
8896
j.y += FlxG.random.float(-num, num);
8997
j.angle = FlxG.random.float(-num / 2, num / 2);
@@ -93,80 +101,96 @@ class TrapLinkFunctions {
93101
for (j in 0...grpNotes.length) {
94102
var strum = grpNotes[j];
95103
strum.playAnim('confirm', true);
96-
strum.animation.finishCallback = function() {
97-
if (APPlatState.instance.isPixelStage) strum.playAnim(colArray[strum.noteData]);
104+
strum.animation.finishCallback = function(animName:String) {
105+
if (PlayState.isPixelStage) strum.playAnim(colArray[strum.noteData]);
98106
else strum.playAnim('color', true);
99107
}
100108
}
101109

102110
position = -1;
103-
didcoolthing = false
111+
didcoolthing = false;
104112
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
105113
}
106114

107-
var position = -1;
108-
var didcoolthing:Bool = false;
109-
function onKeyPress(k) {
110-
if (APPlatState.instance.health > 0.05) {
115+
public static function getKeyFromEvent(key:FlxKey):Int
116+
{
117+
if (key != NONE)
118+
for (i in 0...keysArray[3].length)
119+
for (j in 0...keysArray[3][i].length)
120+
if (key == keysArray[3][i][j])
121+
return i;
122+
return -1;
123+
}
124+
125+
static var position = -1;
126+
static var didcoolthing:Bool = false;
127+
function onKeyPress(k:KeyboardEvent) {
128+
var eventKey:FlxKey = k.keyCode;
129+
var key:Int = getKeyFromEvent(eventKey);
130+
if (APPlayState.instance.health > 0.05) {
111131
if (randArray != null && randArray.length > 0) {
112-
if (k == randArray[1]) {
113-
position = position + 1
132+
if (key == randArray[0]) {
133+
position = position + 1;
114134
var strum = grpNotes[position];
115135
strum.playAnim('pressed', true);
116136
strum.resetAnim = 0.15;
117-
table.remove(randArray, 1)
137+
randArray.remove(randArray[0]);
118138
if (randArray.length < 1 && !didcoolthing) {
119139
if (daCoolTween != null) daCoolTween.cancel();
120140
for (j in grpNotes) {
121141
j.acceleration.y = FlxG.random.float(300, 600);
122142
j.velocity.y = FlxG.random.float(-200, -300);
123143
j.velocity.x = FlxG.random.float(-10, 10);
124144
j.angularVelocity = FlxG.random.float(-15, 15);
125-
FlxTween.tween(j, { alpha: 0 }, 0.2 / game.playbackRate, {
145+
FlxTween.tween(j, { alpha: 0 }, 0.2 / APPlayState.instance.playbackRate, {
126146
onComplete: function(tween:FlxTween)
127147
{
128148
j.kill();
129-
game.remove(j);
149+
APPlayState.instance.remove(j);
130150
},
131-
startDelay: Conductor.crochet * 0.002 / game.playbackRate
151+
startDelay: Conductor.crochet * 0.002 / APPlayState.instance.playbackRate
132152
});
133153
}
134-
APPlatState.instance.playerStrums.forEach(function(str) { str.alpha = 1; });
135-
APPlatState.instance.isCameraOnForcedPos = false;
136-
APPlatState.instance.moveCameraSection();
154+
APPlayState.instance.playerStrums.forEach(function(str) { str.alpha = 1; });
155+
APPlayState.instance.isCameraOnForcedPos = false;
156+
APPlayState.instance.moveCameraSection();
137157
FlxG.sound.play(Paths.sound('bf_vine_defeat'));
138-
APPlatState.instance.boyfriend.stunned = true;
139-
if (APPlatState.instance.health > 0.1)
140-
APPlatState.instance.boyfriend.playAnim('dodge', true);
158+
APPlayState.instance.boyfriend.stunned = true;
159+
if (APPlayState.instance.health > 0.1)
160+
APPlayState.instance.boyfriend.playAnim('dodge', true);
141161

142-
didcoolthing = true
143-
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
162+
didcoolthing = true;
163+
removeListener();
144164
}
145165
}
146166
else {
147-
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
167+
removeListener();
148168
doBushwakThings();
149169
}
150170
}
151171
}
152172
}
153173

174+
function removeListener() {
175+
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
176+
}
177+
154178
public static function startUnown(?timer:Int = 15, ?word:String = 'pain'):Void {
155-
APPlatState.instance.canPause = false;
156-
APPlatState.instance.persistentUpdate = true;
157-
APPlatState.instance.persistentDraw = true;
158-
APPlatState.instance.boyfriend.stunned = true;
179+
APPlayState.instance.canPause = false;
180+
APPlayState.instance.persistentUpdate = true;
181+
APPlayState.instance.persistentDraw = true;
182+
APPlayState.instance.boyfriend.stunned = true;
159183
var realTimer = timer;
160184
var unownState = new UnownSubState(realTimer, word);
161185
unownState.win = wonUnown;
162-
unownState.lose = APPlayState.instance.die;
163-
unownState.cameras = [APPlatState.instance.camHUD];
186+
unownState.lose = APPlayState.instance.killhimtodeath;
187+
unownState.cameras = [APPlayState.instance.camHUD];
164188
FlxG.autoPause = false;
165-
openSubState(unownState);
189+
FlxG.state.openSubState(unownState);
166190
}
167191

168-
function wonUnown():Void {
169-
APPlatState.instance.canPause = true;
170-
APPlatState.instance.boyfriend.stunned = false;
192+
static function wonUnown():Void {
193+
APPlayState.instance.canPause = true;
194+
APPlayState.instance.boyfriend.stunned = false;
171195
}
172196
}

source/archipelago/substates/UnownSubState.hx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
package;
1+
package archipelago.substates;
22

33
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
4-
import Controls.Control;
5-
import flixel.FlxG;
6-
import flixel.FlxSprite;
7-
import flixel.FlxSubState;
8-
import flixel.addons.transition.FlxTransitionableState;
94
import flixel.group.FlxGroup.FlxTypedGroup;
105
import flixel.input.keyboard.FlxKey;
11-
import flixel.system.FlxSound;
12-
import flixel.text.FlxText;
13-
import flixel.tweens.FlxEase;
14-
import flixel.tweens.FlxTween;
15-
import flixel.util.FlxColor;
166
import flixel.effects.FlxFlicker;
17-
import flixel.FlxCamera;
18-
19-
using StringTools;
207

218
class UnownSubState extends MusicBeatSubstate
229
{
@@ -193,9 +180,10 @@ class UnownSubState extends MusicBeatSubstate
193180
if (position >= realWord.length) {
194181
close();
195182
win();
196-
FlxG.sound.play(Paths.sound('CORRECT', 'shared'));
183+
FlxG.sound.play(Paths.sound('traplink/CORRECT'));
197184
}
198185
}
186+
199187
override function update(elapsed:Float)
200188
{
201189
super.update(elapsed);

source/states/PlayState.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4320,6 +4320,17 @@ class PlayState extends MusicBeatState
43204320
doDeathCheck(true);
43214321
}
43224322

4323+
// the void varient of the function above with trueKill set to true
4324+
public function killhimtodeath():Void
4325+
{
4326+
bfkilledcheck = true;
4327+
health = 0;
4328+
lives = 0;
4329+
else lives -= 1;
4330+
noteMissPress(3, opponentmode ? dadField : playerField); // just to make sure you actually die
4331+
doDeathCheck(true);
4332+
}
4333+
43234334
function updateVisPos() { //Literaly so it doesn't look weird in the update function
43244335
try {
43254336
if (visual != null) {

0 commit comments

Comments
 (0)