This commit is contained in:
Yoshman29
2023-01-22 14:37:26 +01:00
15 changed files with 369 additions and 353 deletions
+15 -7
View File
@@ -174,16 +174,18 @@ class CoolUtil
} else
Conductor.changeBPM(DefaultBPM);
}
/**
* Plays a specified Menu SFX.
* @param menuSFX Menu SFX to play
* @param volume At which volume it should play
*/
public static function playMenuSFX(menuSFX:Int = 0, volume:Float = 1) {
public static function playMenuSFX(menuSFX:CoolSfx = SCROLL, volume:Float = 1) {
FlxG.sound.play(Paths.sound(switch(menuSFX) {
case 1: 'menu/confirm';
case 2: 'menu/cancel';
default: 'menu/scroll';
case CONFIRM: 'menu/confirm';
case CANCEL: 'menu/cancel';
case SCROLL: 'menu/scroll';
default: 'menu/scroll';
}), volume);
}
@@ -192,7 +194,7 @@ class CoolUtil
return [for(e in Assets.getText(path).trim().split('\n')) e.trim()];
}
public static inline function numberArray(max:Int, ?min = 0):Array<Int>
public static inline function numberArray(max:Int, ?min:Int = 0):Array<Int>
{
return [for (i in min...max) i];
}
@@ -258,7 +260,7 @@ class CoolUtil
case Y:
obj.y = (cam.height - obj.height) / 2;
case NONE:
}
}
@@ -301,7 +303,7 @@ class CoolUtil
var frames = FlxAtlasFrames.findFrame(graphic);
if (frames != null)
return frames;
trace("no frames yet for multiple atlases!!");
var spritesheets = [];
var cur = 1;
@@ -386,4 +388,10 @@ class CoolUtil
array.push(a);
return array;
}
}
enum abstract CoolSfx(Int) from Int {
var SCROLL = 0;
var CONFIRM = 1;
var CANCEL = 2;
}