1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 23:46:45 +00:00

difficulty rankings and grayscale mockup

This commit is contained in:
Cameron Taylor 2023-08-11 21:45:34 -04:00 committed by EliteMasterEric
parent a8e39d90e8
commit eacd76a0fa
4 changed files with 38 additions and 2 deletions

2
art

@ -1 +1 @@
Subproject commit f4acf8d6e1981ea4d1a28e7e512e335b2a4f261f
Subproject commit fbe23f8b59831ca0123727a35e02cdfb49f3ce60

2
assets

@ -1 +1 @@
Subproject commit abbbc89a83f48317568b5b25eaf831ae16f88a8c
Subproject commit e5aad64d7b5201d23cd28cf740cff48fae6ebf74

View file

@ -8,6 +8,7 @@ import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.text.FlxText;
import flixel.util.FlxTimer;
import funkin.shaderslmfao.Grayscale;
class SongMenuItem extends FlxSpriteGroup
{
@ -24,6 +25,11 @@ class SongMenuItem extends FlxSpriteGroup
var ranks:Array<String> = ["fail", "average", "great", "excellent", "perfect"];
// lol...
var diffRanks:Array<String> = [
"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14", "15"
];
public var targetPos:FlxPoint = new FlxPoint();
public var doLerp:Bool = false;
public var doJumpIn:Bool = false;
@ -31,6 +37,7 @@ class SongMenuItem extends FlxSpriteGroup
public var doJumpOut:Bool = false;
public var onConfirm:Void->Void;
public var diffGrayscale:Grayscale;
public function new(x:Float, y:Float, song:String, ?character:String)
{
@ -53,6 +60,12 @@ class SongMenuItem extends FlxSpriteGroup
ranking.alpha = 0.75;
add(ranking);
diffGrayscale = new Grayscale(1);
var diffRank = new FlxSprite(145, 90).loadGraphic(Paths.image("freeplay/diffRankings/diff" + FlxG.random.getObject(diffRanks)));
diffRank.shader = diffGrayscale;
add(diffRank);
switch (rank)
{
case "perfect":
@ -236,6 +249,7 @@ class SongMenuItem extends FlxSpriteGroup
function set_selected(value:Bool):Bool
{
// cute one liners, lol!
diffGrayscale.setAmount(value ? 0 : 0.8);
songText.alpha = value ? 1 : 0.6;
capsule.offset.x = value ? 0 : -5;
capsule.animation.play(value ? "selected" : "unselected");

View file

@ -0,0 +1,22 @@
package funkin.shaderslmfao;
import flixel.addons.display.FlxRuntimeShader;
import funkin.Paths;
import openfl.utils.Assets;
class Grayscale extends FlxRuntimeShader
{
public var amount:Float = 1;
public function new(amount:Float = 1)
{
super(Assets.getText(Paths.frag("grayscale")));
setAmount(amount);
}
public function setAmount(value:Float):Void
{
amount = value;
this.setFloat("amount", amount);
}
}