-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
137 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package funkin.play.notes.modifier; | ||
|
||
/** | ||
* Class that contains util functions | ||
*/ | ||
class NotePathUtil | ||
{ | ||
/** | ||
* Calculates the transform for the note/trail | ||
* @param modifier The modifier to use | ||
* @param time The delta of strumTime - songTime | ||
* @param scrollSpeed The scrollSpeed | ||
* @param targetPositionX Target x position | ||
* @param targetPositionY Target y position | ||
* @return NoteTransform | ||
*/ | ||
public static function calculatePath(modifier:NotePathModifier, time:Float, scrollSpeed:Float, targetPositionX:Float, targetPositionY:Float):NoteTransform | ||
{ | ||
var transform:NoteTransform = new NoteTransform(targetPositionX, targetPositionY); | ||
|
||
final downscrollSign:Float = (Preferences.downscroll ? -1.0 : 1.0); | ||
|
||
final modifierTransform:NoteTransform = modifier.calculateTransform(time); | ||
|
||
transform.x += modifierTransform.x * Constants.PIXELS_PER_MS * scrollSpeed; | ||
transform.y += modifierTransform.y * Constants.PIXELS_PER_MS * scrollSpeed * downscrollSign; | ||
|
||
return transform; | ||
} | ||
|
||
/** | ||
* Retrieve all currently rendered notes | ||
* This assumes that player and opponent strumlines are initialized | ||
* @return Array<NoteSprite> | ||
*/ | ||
public static function getNotes():Array<NoteSprite> | ||
{ | ||
var notes:Array<NoteSprite> = PlayState.instance.playerStrumline.notes.members.concat(PlayState.instance.opponentStrumline.notes.members); | ||
return notes.filter(function(note:NoteSprite) { | ||
return note != null; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package funkin.play.notes.modifier; | ||
|
||
/** | ||
* Class that contains note transform data | ||
*/ | ||
class NoteTransformRaw | ||
{ | ||
/** | ||
* X position | ||
*/ | ||
public var x:Float; | ||
|
||
/** | ||
* Y position | ||
*/ | ||
public var y:Float; | ||
|
||
public function new(x:Float, y:Float) | ||
{ | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} | ||
|
||
/** | ||
* Wrapper for `NoteTransformRaw` | ||
*/ | ||
@:forward | ||
abstract NoteTransform(NoteTransformRaw) from NoteTransformRaw to NoteTransformRaw | ||
{ | ||
public function new(x:Float, y:Float) | ||
{ | ||
this = new NoteTransformRaw(x, y); | ||
} | ||
|
||
@:op(A + B) | ||
public function op_add(other:NoteTransform):NoteTransform | ||
{ | ||
return new NoteTransform(this.x + other.x, this.y + other.y); | ||
} | ||
|
||
@:op(A - B) | ||
public function op_sub(other:NoteTransform):NoteTransform | ||
{ | ||
return new NoteTransform(this.x - other.x, this.y - other.y); | ||
} | ||
|
||
@:op(A * B) | ||
public function op_mul(other:NoteTransform):NoteTransform | ||
{ | ||
return new NoteTransform(this.x * other.x, this.y * other.y); | ||
} | ||
|
||
@:op(A / B) | ||
public function op_div(other:NoteTransform):NoteTransform | ||
{ | ||
return new NoteTransform(this.x / other.x, this.y / other.y); | ||
} | ||
} |
Oops, something went wrong.