forked from bbpanzu/bb-fnf-mods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuCharacter.hx
79 lines (66 loc) · 2.12 KB
/
MenuCharacter.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
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class CharacterSetting
{
public var x(default, null):Int;
public var y(default, null):Int;
public var scale(default, null):Float;
public var flipped(default, null):Bool;
public function new(x:Int = 0, y:Int = 0, scale:Float = 1.0, flipped:Bool = false)
{
this.x = x;
this.y = y;
this.scale = scale;
this.flipped = flipped;
}
}
class MenuCharacter extends FlxSprite
{
private static var settings:Map<String, CharacterSetting> = [
'bf' => new CharacterSetting(0, -20, 1.0, true),
'gf' => new CharacterSetting(50, 80, 1.5, true),
'dad' => new CharacterSetting(-15, 130),
'spooky' => new CharacterSetting(20, 30),
'pico' => new CharacterSetting(0, 0, 1.0, true),
'mom' => new CharacterSetting(-30, 140, 0.85),
'parents-christmas' => new CharacterSetting(100, 130, 1.8),
'senpai' => new CharacterSetting(-40, -45, 1.4)
];
private var flipped:Bool = false;
public function new(x:Int, y:Int, scale:Float, flipped:Bool)
{
super(x, y);
this.flipped = flipped;
antialiasing = true;
frames = Paths.getSparrowAtlas('campaign_menu_UI_characters');
animation.addByPrefix('bf', "BF idle dance white", 24);
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
animation.addByPrefix('pico', "Pico Idle Dance", 24);
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
setGraphicSize(Std.int(width * scale));
updateHitbox();
}
public function setCharacter(character:String):Void
{
if (character == '')
{
visible = false;
return;
}
else
{
visible = true;
}
animation.play(character);
var setting:CharacterSetting = settings[character];
offset.set(setting.x, setting.y);
setGraphicSize(Std.int(width * setting.scale));
flipX = setting.flipped != flipped;
}
}