Add directionsOverride and colorsOverride to FunkinHitbox

This commit is contained in:
sector-a
2025-04-16 14:57:33 +03:00
committed by KarimAkra
parent 3bcb63cb84
commit 2d8a493897
3 changed files with 11 additions and 7 deletions
+3 -3
View File
@@ -330,12 +330,12 @@ class FunkinHitbox extends FlxTypedSpriteGroup<FunkinHint>
/**
* Creates a new `FunkinHitbox` object.
*/
public function new(?schemeOverride:String = null):Void
public function new(?schemeOverride:String = null, ?directionsOverride:Array<NoteDirection> = null, ?colorsOverride:Array<FlxColor> = null):Void
{
super();
final hintsColors:Array<FlxColor> = [0xFFC34B9A, 0xFF00FFFF, 0xFF12FB06, 0xFFF9393F];
final hintsNoteDirections:Array<NoteDirection> = [NoteDirection.LEFT, NoteDirection.DOWN, NoteDirection.UP, NoteDirection.RIGHT];
final hintsColors:Array<FlxColor> = (colorsOverride == null || colorsOverride.length == 0) ? [0xFFC34B9A, 0xFF00FFFF, 0xFF12FB06, 0xFFF9393F] : colorsOverride;
final hintsNoteDirections:Array<NoteDirection> = (directionsOverride == null || directionsOverride.length == 0) ? [NoteDirection.LEFT, NoteDirection.DOWN, NoteDirection.UP, NoteDirection.RIGHT] : directionsOverride;
final controlsScheme:String = (schemeOverride == null || schemeOverride.length == 0) ? Preferences.controlsScheme : schemeOverride;
switch (controlsScheme)
+4 -2
View File
@@ -18,6 +18,7 @@ import funkin.graphics.FunkinCamera;
import funkin.mobile.ui.FunkinHitbox;
import funkin.mobile.input.PreciseInputHandler;
import funkin.mobile.ui.FunkinBackspace;
import funkin.play.notes.NoteDirection;
#end
/**
@@ -67,7 +68,8 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler
public var backButton:FunkinBackspace;
public var camControls:FunkinCamera;
public function addHitbox(?visible:Bool = true, ?initInput:Bool = true, ?schemeOverride:String = null):Void
public function addHitbox(?visible:Bool = true, ?initInput:Bool = true, ?schemeOverride:String = null, ?directionsOverride:Array<NoteDirection> = null,
?colorsOverride:Array<FlxColor> = null):Void
{
if (hitbox != null)
{
@@ -83,7 +85,7 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler
camControls.bgColor = 0x0;
}
hitbox = new FunkinHitbox(schemeOverride);
hitbox = new FunkinHitbox(schemeOverride, directionsOverride, colorsOverride);
hitbox.cameras = [camControls];
hitbox.visible = visible;
add(hitbox);
+4 -2
View File
@@ -17,6 +17,7 @@ import funkin.graphics.FunkinCamera;
import funkin.mobile.ui.FunkinHitbox;
import funkin.mobile.input.PreciseInputHandler;
import funkin.mobile.ui.FunkinBackspace;
import funkin.play.notes.NoteDirection;
#end
/**
@@ -52,7 +53,8 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler
public var backButton:FunkinBackspace;
public var camControls:FunkinCamera;
public function addHitbox(?visible:Bool = true, ?initInput:Bool = true, ?schemeOverride:String = null):Void
public function addHitbox(?visible:Bool = true, ?initInput:Bool = true, ?schemeOverride:String = null, ?directionsOverride:Array<NoteDirection> = null,
?colorsOverride:Array<FlxColor> = null):Void
{
if (hitbox != null)
{
@@ -68,7 +70,7 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler
camControls.bgColor = 0x0;
}
hitbox = new FunkinHitbox(schemeOverride);
hitbox = new FunkinHitbox(schemeOverride, directionsOverride, colorsOverride);
hitbox.cameras = [camControls];
hitbox.visible = visible;
add(hitbox);