1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-05-21 06:31:19 +00:00

hopefully final polish?

This commit is contained in:
anysad 2024-07-18 17:56:54 +03:00
parent ff1ab1eb42
commit ba96b11196
2 changed files with 16 additions and 20 deletions

View file

@ -61,8 +61,6 @@ class Countdown
// @:privateAccess // @:privateAccess
// PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0));
fetchNoteStyle();
// The timer function gets called based on the beat of the song. // The timer function gets called based on the beat of the song.
countdownTimer = new FlxTimer(); countdownTimer = new FlxTimer();
@ -80,10 +78,10 @@ class Countdown
// PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0));
// Countdown graphic. // Countdown graphic.
showCountdownGraphic(countdownStep, noteStyle); showCountdownGraphic(countdownStep);
// Countdown sound. // Countdown sound.
playCountdownSound(countdownStep, noteStyle); playCountdownSound(countdownStep);
// Event handling bullshit. // Event handling bullshit.
var cancelled:Bool = propagateCountdownEvent(countdownStep); var cancelled:Bool = propagateCountdownEvent(countdownStep);
@ -212,7 +210,7 @@ class Countdown
/** /**
* Retrieves the graphic to use for this step of the countdown. * Retrieves the graphic to use for this step of the countdown.
*/ */
public static function showCountdownGraphic(index:CountdownStep, noteStyle:NoteStyle):Void public static function showCountdownGraphic(index:CountdownStep):Void
{ {
var indexString:String = null; var indexString:String = null;
switch (index) switch (index)
@ -229,25 +227,24 @@ class Countdown
if (indexString == null) return; if (indexString == null) return;
var spritePath:String = null; var spritePath:String = null;
spritePath = resolveGraphicPath(noteStyle, indexString); spritePath = resolveGraphicPath(indexString);
if (spritePath == null) return; if (spritePath == null) return;
var countdownSprite:FunkinSprite = FunkinSprite.create(spritePath); var countdownSprite:FunkinSprite = FunkinSprite.create(spritePath);
countdownSprite.scrollFactor.set(0, 0); countdownSprite.scrollFactor.set(0, 0);
if (isPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE * 1.1)); if (isPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE));
else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.8)); else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.7));
countdownSprite.antialiasing = !isPixel; countdownSprite.antialiasing = !isPixel;
countdownSprite.cameras = [PlayState.instance.camHUD]; countdownSprite.cameras = [PlayState.instance.camHUD];
countdownSprite.updateHitbox(); countdownSprite.updateHitbox();
countdownSprite.screenCenter();
// Fade sprite in, then out, then destroy it. // Fade sprite in, then out, then destroy it.
FlxTween.tween(countdownSprite, {y: countdownSprite.y += 100, alpha: 0}, Conductor.instance.beatLengthMs / 1000, FlxTween.tween(countdownSprite, {alpha: 0}, Conductor.instance.beatLengthMs / 1000,
{ {
ease: FlxEase.cubeInOut, ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween) { onComplete: function(twn:FlxTween) {
@ -256,9 +253,10 @@ class Countdown
}); });
PlayState.instance.add(countdownSprite); PlayState.instance.add(countdownSprite);
countdownSprite.screenCenter();
} }
static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null<String> static function resolveGraphicPath(index:String):Null<String>
{ {
fetchNoteStyle(); fetchNoteStyle();
var basePath:String = 'ui/countdown/'; var basePath:String = 'ui/countdown/';
@ -285,12 +283,12 @@ class Countdown
/** /**
* Retrieves the sound file to use for this step of the countdown. * Retrieves the sound file to use for this step of the countdown.
*/ */
public static function playCountdownSound(step:CountdownStep, noteStyle:NoteStyle):Void public static function playCountdownSound(step:CountdownStep):Void
{ {
return FunkinSound.playOnce(Paths.sound(resolveSoundPath(noteStyle, step)), Constants.COUNTDOWN_VOLUME); return FunkinSound.playOnce(Paths.sound(resolveSoundPath(step)), Constants.COUNTDOWN_VOLUME);
} }
static function resolveSoundPath(noteStyle:NoteStyle, step:CountdownStep):Null<String> static function resolveSoundPath(step:CountdownStep):Null<String>
{ {
if (step == CountdownStep.BEFORE || step == CountdownStep.AFTER) return null; if (step == CountdownStep.BEFORE || step == CountdownStep.AFTER) return null;
fetchNoteStyle(); fetchNoteStyle();

View file

@ -29,8 +29,6 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
override public function new() override public function new()
{ {
super(); super();
fetchNoteStyle();
} }
static function fetchNoteStyle():Void static function fetchNoteStyle():Void
@ -42,7 +40,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
isPixel = false; isPixel = false;
} }
static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null<String> static function resolveGraphicPath(index:String):Null<String>
{ {
fetchNoteStyle(); fetchNoteStyle();
var basePath:String = 'ui/popup/'; var basePath:String = 'ui/popup/';
@ -72,7 +70,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
if (daRating == null) daRating = "good"; if (daRating == null) daRating = "good";
var ratingPath:String = resolveGraphicPath(noteStyle, daRating); var ratingPath:String = resolveGraphicPath(daRating);
//if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel"; //if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel";
@ -122,7 +120,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
if (combo == null) combo = 0; if (combo == null) combo = 0;
var comboPath:String = resolveGraphicPath(noteStyle, 'combo'); var comboPath:String = resolveGraphicPath('combo');
var comboSpr:FunkinSprite = FunkinSprite.create(comboPath); var comboSpr:FunkinSprite = FunkinSprite.create(comboPath);
comboSpr.y = (FlxG.camera.height * 0.44) + offsets[1]; comboSpr.y = (FlxG.camera.height * 0.44) + offsets[1];
comboSpr.x = (FlxG.width * 0.507) + offsets[0]; comboSpr.x = (FlxG.width * 0.507) + offsets[0];
@ -165,7 +163,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
var daLoop:Int = 1; var daLoop:Int = 1;
for (i in seperatedScore) for (i in seperatedScore)
{ {
var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath(noteStyle, 'num' + Std.int(i))); var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath('num' + Std.int(i)));
if (isPixel) numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7)); if (isPixel) numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7));
else numScore.setGraphicSize(Std.int(numScore.width * 0.45)); else numScore.setGraphicSize(Std.int(numScore.width * 0.45));