-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Copy pathCharSelectPlayer.hx
90 lines (75 loc) · 2.33 KB
/
CharSelectPlayer.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package funkin.ui.charSelect;
import flixel.FlxSprite;
import funkin.graphics.adobeanimate.FlxAtlasSprite;
import flxanimate.animate.FlxKeyFrame;
import funkin.modding.IScriptedClass.IBPMSyncedScriptedClass;
import funkin.modding.events.ScriptEvent;
class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass
{
public function new(x:Float, y:Float)
{
super(x, y, Paths.animateAtlas("charSelect/bfChill"));
onAnimationComplete.add(function(animLabel:String) {
switch (animLabel)
{
case "slidein":
if (hasAnimation("slidein idle point"))
{
playAnimation("slidein idle point", true, false, false);
}
else
{
playAnimation("idle", true, false, false);
}
case "deselect":
playAnimation("deselect loop start", true, false, true);
case "slidein idle point", "cannot select Label", "unlock":
playAnimation("idle", true, false, false);
case "idle":
trace('Waiting for onBeatHit');
}
});
}
public function onStepHit(event:SongTimeScriptEvent):Void {}
public function onBeatHit(event:SongTimeScriptEvent):Void
{
// TODO: There's a minor visual bug where there's a little stutter.
// This happens because the animation is getting restarted while it's already playing.
// I tried make this not interrupt an existing idle,
// but isAnimationFinished() and isLoopComplete() both don't work! What the hell?
// danceEvery isn't necessary if that gets fixed.
//
if (getCurrentAnimation() == "idle")
{
playAnimation("idle", true, false, false);
}
};
public function updatePosition(str:String)
{
switch (str)
{
case "bf":
x = 0;
y = 0;
case "pico":
x = 0;
y = 0;
case "random":
}
}
public function switchChar(str:String)
{
switch str
{
default:
loadAtlas(Paths.animateAtlas("charSelect/" + str + "Chill"));
}
playAnimation("slidein", true, false, false);
updateHitbox();
updatePosition(str);
}
public function onScriptEvent(event:ScriptEvent):Void {};
public function onCreate(event:ScriptEvent):Void {};
public function onDestroy(event:ScriptEvent):Void {};
public function onUpdate(event:UpdateScriptEvent):Void {};
}