strum system rework

This commit is contained in:
Yoshman29
2023-01-19 14:58:17 +01:00
parent 5db3772d4b
commit 74bd79fe77
5 changed files with 208 additions and 142 deletions
+17 -4
View File
@@ -18,7 +18,19 @@ class Note extends FlxSprite
{
public var strumTime:Float = 0;
public var mustPress:Bool = false;
public var mustPress(get, never):Bool;
public var player(get, never):StrumLine;
private function get_player() {
if (PlayState.instance != null)
return PlayState.instance.players[playerID];
return null;
}
private function get_mustPress():Bool {
if (PlayState.instance != null)
return PlayState.instance.players[playerID] != null && !PlayState.instance.players[playerID].cpu;
return playerID == 1;
}
public var noteData:Int = 0;
public var canBeHit:Bool = false;
public var tooLate:Bool = false;
@@ -60,6 +72,7 @@ class Note extends FlxSprite
public var flipSustain:Bool = true;
public var noteTypeID:Int = 0;
public var playerID:Int = 0;
// TO APPLY THOSE ON A SINGLE NOTE
public var scrollSpeed:Null<Float> = null;
@@ -80,7 +93,7 @@ class Note extends FlxSprite
public var animSuffix:String = "";
public function new(strumTime:Float, noteData:Int, noteType:Int = 0, mustPress:Bool = true, ?prevNote:Note, ?sustainNote:Bool = false, animSuffix:String = "")
public function new(strumTime:Float, noteData:Int, noteType:Int = 0, playerID:Int = 1, ?prevNote:Note, ?sustainNote:Bool = false, animSuffix:String = "")
{
super();
@@ -88,7 +101,7 @@ class Note extends FlxSprite
prevNote = this;
this.prevNote = prevNote;
this.mustPress = mustPress;
this.playerID = playerID;
this.noteTypeID = noteType;
isSustainNote = sustainNote;
@@ -100,7 +113,7 @@ class Note extends FlxSprite
this.noteData = noteData;
var customType = Paths.image('game/notes/${this.noteType}');
var event = EventManager.get(NoteCreationEvent).recycle(this, strumID, this.noteType, noteTypeID, mustPress, Assets.exists(customType) ? 'game/notes/${this.noteType}' : 'game/NOTE_assets', 0.7, animSuffix);
var event = EventManager.get(NoteCreationEvent).recycle(this, strumID, this.noteType, noteTypeID, playerID, mustPress, Assets.exists(customType) ? 'game/notes/${this.noteType}' : 'game/NOTE_assets', 0.7, animSuffix);
if (PlayState.instance != null)
event = PlayState.instance.scripts.event("onNoteCreation", event);