2022-03-08 08:13:53 +00:00
|
|
|
package funkin;
|
2021-03-26 07:51:39 +00:00
|
|
|
|
|
|
|
import flixel.FlxSprite;
|
|
|
|
import haxe.io.Path;
|
2023-06-27 21:22:51 +00:00
|
|
|
import flixel.graphics.frames.FlxAtlasFrames;
|
2021-03-26 07:51:39 +00:00
|
|
|
|
|
|
|
class NoteSplash extends FlxSprite
|
|
|
|
{
|
2023-01-23 03:25:45 +00:00
|
|
|
public function new(x:Float, y:Float, noteData:Int = 0):Void
|
|
|
|
{
|
|
|
|
super(x, y);
|
|
|
|
|
2023-06-27 21:22:51 +00:00
|
|
|
animation.addByPrefix('note0-0', 'note impact 1 purple', 24, false);
|
2023-01-23 03:25:45 +00:00
|
|
|
animation.addByPrefix('note1-0', 'note impact 1 blue', 24, false);
|
|
|
|
animation.addByPrefix('note2-0', 'note impact 1 green', 24, false);
|
|
|
|
animation.addByPrefix('note3-0', 'note impact 1 red', 24, false);
|
2023-06-27 21:22:51 +00:00
|
|
|
animation.addByPrefix('note0-1', 'note impact 2 purple', 24, false);
|
2023-01-23 03:25:45 +00:00
|
|
|
animation.addByPrefix('note1-1', 'note impact 2 blue', 24, false);
|
|
|
|
animation.addByPrefix('note2-1', 'note impact 2 green', 24, false);
|
|
|
|
animation.addByPrefix('note3-1', 'note impact 2 red', 24, false);
|
|
|
|
|
|
|
|
setupNoteSplash(x, y, noteData);
|
|
|
|
|
|
|
|
// alpha = 0.75;
|
|
|
|
}
|
|
|
|
|
2023-06-27 21:22:51 +00:00
|
|
|
public static function buildSplashFrames(force:Bool = false):FlxAtlasFrames
|
|
|
|
{
|
|
|
|
// static variables inside functions are a cool of Haxe 4.3.0.
|
|
|
|
static var splashFrames:FlxAtlasFrames = null;
|
|
|
|
|
|
|
|
if (splashFrames != null && !force) return splashFrames;
|
|
|
|
|
|
|
|
splashFrames = Paths.getSparrowAtlas('noteSplashes');
|
|
|
|
|
|
|
|
splashFrames.parent.persist = true;
|
|
|
|
|
|
|
|
return splashFrames;
|
|
|
|
}
|
|
|
|
|
2023-01-23 03:25:45 +00:00
|
|
|
public function setupNoteSplash(x:Float, y:Float, noteData:Int = 0)
|
|
|
|
{
|
|
|
|
setPosition(x, y);
|
|
|
|
alpha = 0.6;
|
|
|
|
|
|
|
|
animation.play('note' + noteData + '-' + FlxG.random.int(0, 1), true);
|
|
|
|
animation.curAnim.frameRate = 24 + FlxG.random.int(-2, 2);
|
2023-06-08 20:30:45 +00:00
|
|
|
animation.finishCallback = function(name) {
|
2023-01-23 03:25:45 +00:00
|
|
|
kill();
|
|
|
|
};
|
|
|
|
updateHitbox();
|
|
|
|
|
|
|
|
offset.set(width * 0.3, height * 0.3);
|
|
|
|
}
|
2021-03-26 07:51:39 +00:00
|
|
|
}
|