Skip to content

Commit

Permalink
sustains scale correctly when changing scroll speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Dec 3, 2024
1 parent c2fb7e4 commit d87dfd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 13 additions & 1 deletion source/game/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Note extends FlxSkewedSprite {

public var song:SongData;

public var speed:Float = 1;
public var speed(default, set):Float = 1;

#if MODCHARTING_TOOLS
/**
Expand Down Expand Up @@ -334,6 +334,18 @@ class Note extends FlxSkewedSprite {
frame = frames.frames[animation.frameIndex];
return rect;
}

@:noCompletion function set_speed(speed:Float):Float {
if(isSustainNote && !inEditor && animation != null && !animation?.curAnim?.name?.endsWith('end')){
scale.y = Std.parseFloat(PlayState.instance.ui_settings[0]) * (Std.parseFloat(PlayState.instance.ui_settings[2])
- (Std.parseFloat(PlayState.instance.mania_size[3])));
scale.y *= Conductor.stepCrochet / 100 * 1.5 * speed;
updateHitbox();
centerOffsets();
centerOrigin();
}
return this.speed = speed;
}
}

typedef NoteType = {
Expand Down
1 change: 0 additions & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,6 @@ class PlayState extends MusicBeatState {

var swagNote:Note = new Note(daStrumTime, noteData, oldNote, false, char, songNotes[4], null, chars, gottaHitNote);
swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0);

unspawnNotes.push(swagNote);

Expand Down

0 comments on commit d87dfd5

Please sign in to comment.