Skip to content

Add extra info for Note Splashes #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions source/funkin/game/Splash.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package funkin.game;

class Splash extends FunkinSprite
{
/**
* The current splash strum
* WANRNING: It can be null
*/
public var strum:Null<Strum>;

/**
* Shortcut to `strum.ID`
* WARNING: It can be null
*/
public var strumID:Null<Int>;

public static function copyFrom(source:Splash):Splash
{
var spr = new Splash();
@:privateAccess {
spr.setPosition(source.x, source.y);
spr.frames = source.frames;
if (source.animateAtlas != null && source.atlasPath != null)
spr.loadSprite(source.atlasPath);
spr.animation.copyFrom(source.animation);
spr.visible = source.visible;
spr.alpha = source.alpha;
spr.antialiasing = source.antialiasing;
spr.scale.set(source.scale.x, source.scale.y);
spr.scrollFactor.set(source.scrollFactor.x, source.scrollFactor.y);
spr.skew.set(source.skew.x, source.skew.y);
spr.transformMatrix = source.transformMatrix;
spr.matrixExposed = source.matrixExposed;
spr.zoomFactor = source.zoomFactor;
spr.animOffsets = source.animOffsets.copy();
}
return spr;
}
}
17 changes: 11 additions & 6 deletions source/funkin/game/SplashGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package funkin.game;

import haxe.xml.Access;

class SplashGroup extends FlxTypedGroup<FunkinSprite> {
class SplashGroup extends FlxTypedGroup<Splash> {
/**
* Whenever the splash group has successfully loaded or not.
*/
Expand Down Expand Up @@ -46,7 +46,7 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
}

function createSplash(imagePath:String) {
var splash = new FunkinSprite();
var splash = new Splash();
splash.antialiasing = true;
splash.active = splash.visible = false;
splash.loadSprite(Paths.image(imagePath));
Expand All @@ -56,7 +56,7 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
return splash;
}

function setupAnims(xml:Access, splash:FunkinSprite) {
function setupAnims(xml:Access, splash:Splash) {
for(strum in xml.nodes.strum) {
var id:Null<Int> = Std.parseInt(strum.att.id);
if (id != null) {
Expand Down Expand Up @@ -85,12 +85,14 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
};
}

function pregenerateSplashes(splash:FunkinSprite) {
function pregenerateSplashes(splash:Splash) {
// make 7 additional splashes
for(i in 0...7) {
var spr = FunkinSprite.copyFrom(splash);
var spr = Splash.copyFrom(splash);
spr.animation.finishCallback = function(name:String) {
spr.active = spr.visible = false;
spr.strum = null;
spr.strumID = null;
};
add(spr);
}
Expand All @@ -103,11 +105,14 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
return animationNames[id][FlxG.random.int(0, animationNames[id].length - 1)];
}

var __splash:FunkinSprite;
var __splash:Splash;
public function showOnStrum(strum:Strum) {
if (!valid) return null;
__splash = recycle();

__splash.strum = strum;
__splash.strumID = strum.ID;

__splash.cameras = strum.lastDrawCameras;
__splash.setPosition(strum.x + ((strum.width - __splash.width) / 2), strum.y + ((strum.height - __splash.height) / 2));
__splash.active = __splash.visible = true;
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/game/SplashHandler.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package funkin.game;


class SplashHandler extends FlxTypedGroup<FunkinSprite> {
class SplashHandler extends FlxTypedGroup<Splash> {
/**
* Map containing all of the splashes group.
*/
Expand Down