latest build
This commit is contained in:
@@ -773,8 +773,8 @@ class PlayState extends MusicBeatState
|
||||
if (health > 2)
|
||||
health = 2;
|
||||
|
||||
iconP1.health = health / 2;
|
||||
iconP2.health = 1 - (health / 2);
|
||||
iconP1.health = healthBar.percent;
|
||||
iconP2.health = 1 - (healthBar.percent);
|
||||
|
||||
/* if (FlxG.keys.justPressed.NINE)
|
||||
FlxG.switchState(new Charting()); */
|
||||
@@ -945,29 +945,6 @@ class PlayState extends MusicBeatState
|
||||
var toDelete:Array<Note> = [];
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
if (daNote.mustPress)
|
||||
{
|
||||
daNote.canBeHit = (daNote.strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * daNote.latePressWindow)
|
||||
&& daNote.strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * daNote.earlyPressWindow));
|
||||
|
||||
if (daNote.strumTime < Conductor.songPosition - Conductor.safeZoneOffset && !daNote.wasGoodHit)
|
||||
daNote.tooLate = true;
|
||||
}
|
||||
else
|
||||
daNote.canBeHit = false;
|
||||
|
||||
if (!daNote.mustPress && !daNote.wasGoodHit && daNote.strumTime <= Conductor.songPosition) goodNoteHit(daNote);
|
||||
// TODO: FIXED STEP CROCHET PER NOTES FOR BPM CHANGES
|
||||
if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + (Conductor.stepCrochet) < Conductor.songPosition) {
|
||||
deleteNote(daNote);
|
||||
return;
|
||||
}
|
||||
|
||||
if (daNote.tooLate) {
|
||||
noteMiss(daNote);
|
||||
return;
|
||||
}
|
||||
|
||||
var strum:Strum = null;
|
||||
for(e in (daNote.mustPress ? playerStrums : cpuStrums).members) {
|
||||
if (e.ID == daNote.noteData % 4) {
|
||||
@@ -975,10 +952,44 @@ class PlayState extends MusicBeatState
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strum == null) return;
|
||||
|
||||
var event = PlayState.instance.scripts.event("onNoteUpdate", new NoteUpdateEvent(daNote, elapsed, strum));
|
||||
if (!event.cancelled) {
|
||||
if (event.__updateHitWindow) {
|
||||
if (daNote.mustPress)
|
||||
{
|
||||
daNote.canBeHit = (daNote.strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * daNote.latePressWindow)
|
||||
&& daNote.strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * daNote.earlyPressWindow));
|
||||
|
||||
if (daNote.strumTime < Conductor.songPosition - Conductor.safeZoneOffset && !daNote.wasGoodHit)
|
||||
daNote.tooLate = true;
|
||||
}
|
||||
else
|
||||
daNote.canBeHit = false;
|
||||
}
|
||||
|
||||
if (event.__autoCPUHit && !daNote.mustPress && !daNote.wasGoodHit && daNote.strumTime <= Conductor.songPosition) goodNoteHit(daNote);
|
||||
// TODO: FIXED STEP CROCHET PER NOTES FOR BPM CHANGES
|
||||
|
||||
strum.updateNotePosition(daNote);
|
||||
strum.updateClipRect(daNote);
|
||||
if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + (Conductor.stepCrochet) < Conductor.songPosition) {
|
||||
deleteNote(daNote);
|
||||
return;
|
||||
}
|
||||
|
||||
if (daNote.tooLate) {
|
||||
noteMiss(daNote);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (event.strum == null) return;
|
||||
|
||||
if (event.__reposNote) event.strum.updateNotePosition(daNote);
|
||||
event.strum.updateClipRect(daNote);
|
||||
|
||||
PlayState.instance.scripts.event("onNoteUpdatePost", event);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package funkin.scripting.events;
|
||||
|
||||
import funkin.game.Note;
|
||||
import funkin.game.Strum;
|
||||
|
||||
class NoteUpdateEvent extends CancellableEvent {
|
||||
@:dox(hide) public var __updateHitWindow = true;
|
||||
@:dox(hide) public var __autoCPUHit = true;
|
||||
@:dox(hide) public var __reposNote = true;
|
||||
/**
|
||||
* Note that is being updated
|
||||
*/
|
||||
public var note:Note;
|
||||
|
||||
/**
|
||||
* Time elapsed since last frame
|
||||
*/
|
||||
public var elapsed:Float;
|
||||
|
||||
/**
|
||||
* Note's strum (can be changed)
|
||||
*/
|
||||
public var strum:Strum;
|
||||
|
||||
public function new(note:Note, elapsed:Float, strum:Strum) {
|
||||
super();
|
||||
this.note = note;
|
||||
this.elapsed = elapsed;
|
||||
this.strum = strum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the hit window update.
|
||||
*/
|
||||
public function cancelWindowUpdate() {
|
||||
__updateHitWindow = false;
|
||||
}
|
||||
@:dox(hide) public function preventWindowUpdate() { cancelWindowUpdate(); }
|
||||
|
||||
/**
|
||||
* Cancels the automatic CPU hit.
|
||||
*/
|
||||
public function cancelAutoCPUHit() {
|
||||
__autoCPUHit = false;
|
||||
}
|
||||
@:dox(hide) public function preventAutoCPUHit() { cancelAutoCPUHit(); }
|
||||
|
||||
/**
|
||||
* Cancels the note position update (note will freeze).
|
||||
*/
|
||||
public function cancelPositionUpdate() {
|
||||
__reposNote = false;
|
||||
}
|
||||
@:dox(hide) public function preventPositionUpdate() { cancelPositionUpdate(); }
|
||||
}
|
||||
Reference in New Issue
Block a user