mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-08-31 19:04:55 +00:00
Compare commits
3 commits
12eb372e42
...
96936694eb
Author | SHA1 | Date | |
---|---|---|---|
|
96936694eb | ||
|
7114fd91da | ||
|
c62383511f |
|
@ -2070,6 +2070,8 @@ class FreeplayState extends MusicBeatSubState
|
|||
{
|
||||
backingCard.beatHit();
|
||||
|
||||
grpCapsules?.members[0]?.randomiseDisplay();
|
||||
|
||||
return super.beatHit();
|
||||
}
|
||||
|
||||
|
@ -2941,10 +2943,13 @@ class DifficultySelector extends FlxSprite
|
|||
|
||||
override function update(elapsed:Float):Void
|
||||
{
|
||||
Conductor.instance.update();
|
||||
|
||||
if (!controls.active) return;
|
||||
|
||||
if (flipX && controls.UI_RIGHT_P) moveShitDown();
|
||||
if (!flipX && controls.UI_LEFT_P) moveShitDown();
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
|
|
|
@ -431,6 +431,56 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
updateSelected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for the random capsule.
|
||||
* Randomises the BPM and difficulty value until they're different, then updates the display.
|
||||
*/
|
||||
public function randomiseDisplay():Void
|
||||
{
|
||||
// No need to do any of this if the capsule won't actually be visible.
|
||||
if (targetPos.y < -200 || targetPos.y > FlxG.height + 200) return;
|
||||
|
||||
var randomDifficulty:Int = FlxG.random.int(0, 20);
|
||||
var currentDifficulty:Int = 0;
|
||||
var randomBPM:Int = FlxG.random.int(0, 999);
|
||||
var currentBPM:Int = 0;
|
||||
|
||||
// Get the current value so we can keep randomising until we get a different one.
|
||||
for (i in 0...bigNumbers.length)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
currentDifficulty += bigNumbers[i].digit * 10;
|
||||
case 1:
|
||||
currentDifficulty += bigNumbers[i].digit;
|
||||
}
|
||||
}
|
||||
|
||||
// Hopefully this never takes so long that it causes a bit of lag...
|
||||
while (currentDifficulty == randomDifficulty)
|
||||
randomDifficulty = FlxG.random.int(0, 20);
|
||||
|
||||
for (i in 0...smallNumbers.length)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
randomBPM += smallNumbers[i].digit * 100;
|
||||
case 1:
|
||||
randomBPM += smallNumbers[i].digit * 10;
|
||||
case 2:
|
||||
randomBPM += smallNumbers[i].digit;
|
||||
}
|
||||
}
|
||||
|
||||
while (currentBPM == randomBPM)
|
||||
currentBPM = FlxG.random.int(0, 999);
|
||||
|
||||
updateBPM(randomBPM);
|
||||
updateDifficultyRating(randomDifficulty);
|
||||
}
|
||||
|
||||
function updateDifficultyRating(newRating:Int):Void
|
||||
{
|
||||
var ratingPadded:String = newRating < 10 ? '0$newRating' : '$newRating';
|
||||
|
@ -544,7 +594,7 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
initData(null, styleData, 1);
|
||||
y = intendedY(0) + 10;
|
||||
targetPos.x = x;
|
||||
alpha = 0.5;
|
||||
alpha = 1;
|
||||
songText.visible = false;
|
||||
favIcon.visible = false;
|
||||
favIconBlurred.visible = false;
|
||||
|
@ -861,7 +911,13 @@ class FreeplayRank extends FlxSpriteGroup
|
|||
|
||||
class CapsuleNumber extends FlxSprite
|
||||
{
|
||||
public var digit(default, set):Int = 0;
|
||||
@:isVar
|
||||
public var digit(get, set):Int = 0;
|
||||
|
||||
function get_digit():Int
|
||||
{
|
||||
return this.digit;
|
||||
}
|
||||
|
||||
function set_digit(val):Int
|
||||
{
|
||||
|
@ -869,6 +925,8 @@ class CapsuleNumber extends FlxSprite
|
|||
|
||||
centerOffsets(false);
|
||||
|
||||
this.digit = val;
|
||||
|
||||
switch (val)
|
||||
{
|
||||
case 1:
|
||||
|
|
Loading…
Reference in a new issue