mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-26 17:46:08 -05:00
multiplicative added!! + sum tween fixes
This commit is contained in:
parent
5fd2ea0bcf
commit
96de434d75
2 changed files with 30 additions and 5 deletions
|
@ -3259,6 +3259,8 @@ class PlayState extends MusicBeatSubState
|
|||
cancelCameraZoomTween();
|
||||
}
|
||||
|
||||
var prevScrollTargets:Array<Dynamic> = []; // used to snap scroll speed when things go unruely
|
||||
|
||||
/**
|
||||
* The magical function that shall tween the scroll speed.
|
||||
*/
|
||||
|
@ -3266,6 +3268,18 @@ class PlayState extends MusicBeatSubState
|
|||
{
|
||||
// Cancel the current tween if it's active.
|
||||
cancelScrollSpeedTweens();
|
||||
|
||||
// Snap to previous event value to prevent the tween breaking when another event cancels the previous tween.
|
||||
for (i in prevScrollTargets)
|
||||
{
|
||||
var value:Float = i[1];
|
||||
var strum:Strumline = Reflect.getProperty(this, i[0]);
|
||||
strum.scrollSpeed = value;
|
||||
}
|
||||
|
||||
// for next event, clean array.
|
||||
prevScrollTargets = [];
|
||||
|
||||
for (i in strumlines)
|
||||
{
|
||||
var value:Float = speed;
|
||||
|
@ -3282,6 +3296,8 @@ class PlayState extends MusicBeatSubState
|
|||
'scrollSpeed': value
|
||||
}, duration, {ease: ease}));
|
||||
}
|
||||
// make sure charts dont break if the charter is dumb and stupid
|
||||
prevScrollTargets.push([value, i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ class ScrollSpeedEvent extends SongEvent
|
|||
static final DEFAULT_SCROLL:Float = 1;
|
||||
static final DEFAULT_DURATION:Float = 4.0;
|
||||
static final DEFAULT_EASE:String = 'linear';
|
||||
static final DEFAULT_ABSOLUTE:Bool = false;
|
||||
static final DEFAULT_STRUMLINE:String = 'both'; // my special little trick
|
||||
|
||||
public override function handleEvent(data:SongEventData):Void
|
||||
|
@ -51,12 +52,14 @@ class ScrollSpeedEvent extends SongEvent
|
|||
|
||||
var strumline:String = data.getString('strumline') ?? DEFAULT_STRUMLINE;
|
||||
|
||||
var absolute:Bool = data.getBool('absolute') ?? DEFAULT_ABSOLUTE;
|
||||
|
||||
var strumlineNames:Array<String> = [];
|
||||
|
||||
if (scroll == 0)
|
||||
if (!absolute)
|
||||
{
|
||||
// if the parameter is set to 0, reset the scroll speed to normal.
|
||||
scroll = PlayState.instance?.currentChart?.scrollSpeed ?? 1.0;
|
||||
// If absolute is set to false, do the awesome multiplicative thing
|
||||
scroll = scroll * (PlayState.instance?.currentChart?.scrollSpeed ?? 1.0);
|
||||
}
|
||||
|
||||
switch (strumline)
|
||||
|
@ -103,8 +106,8 @@ class ScrollSpeedEvent extends SongEvent
|
|||
return new SongEventSchema([
|
||||
{
|
||||
name: 'scroll',
|
||||
title: 'Scroll Amount',
|
||||
defaultValue: 0.0,
|
||||
title: 'Target Value',
|
||||
defaultValue: 1.0,
|
||||
step: 0.1,
|
||||
type: SongEventFieldType.FLOAT,
|
||||
units: 'x'
|
||||
|
@ -157,6 +160,12 @@ class ScrollSpeedEvent extends SongEvent
|
|||
defaultValue: 'both',
|
||||
type: SongEventFieldType.ENUM,
|
||||
keys: ['Both' => 'both', 'Player' => 'player', 'Opponent' => 'opponent']
|
||||
},
|
||||
{
|
||||
name: 'absolute',
|
||||
title: 'Absolute',
|
||||
defaultValue: false,
|
||||
type: SongEventFieldType.BOOL,
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue