Skip to content

Commit

Permalink
MORE SCRIPTED STUFF
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Oct 21, 2024
1 parent ac3f44c commit d9692d3
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 14 deletions.
8 changes: 8 additions & 0 deletions source/funkin/modding/base/ScriptedFlxBackdrop.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package funkin.modding.base;

/**
* A script that can be tied to an FlxBackdrop.
* Create a scripted class that extends FlxBackdrop to use this.
*/
@:hscriptClass
class ScriptedFlxBackdrop extends flixel.addons.display.FlxBackdrop implements HScriptedClass {}
8 changes: 8 additions & 0 deletions source/funkin/modding/base/ScriptedFlxPieDial.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package funkin.modding.base;

/**
* A script that can be tied to an FlxPieDial.
* Create a scripted class that extends FlxPieDial to use this.
*/
@:hscriptClass
class ScriptedFlxPieDial extends flixel.addons.display.FlxPieDial implements HScriptedClass {}
8 changes: 8 additions & 0 deletions source/funkin/modding/base/ScriptedFlxText.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package funkin.modding.base;

/**
* A script that can be tied to an FlxText.
* Create a scripted class that extends FlxText to use this.
*/
@:hscriptClass
class ScriptedFlxText extends flixel.text.FlxText implements HScriptedClass {}
4 changes: 2 additions & 2 deletions source/funkin/play/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1816,14 +1816,14 @@ class PlayState extends MusicBeatSubState
healthBar.numDivisions = Std.int(healthBarBG.width - 8);
add(healthBar);

funnySexBox = new FlxSprite(healthBarBG.x + healthBarBG.width - 545, healthBarBG.y + 41).makeGraphic(500, 20, FlxColor.BLACK);
funnySexBox = new FlxSprite(healthBarBG.x + healthBarBG.width - 545, healthBarBG.y + 40).makeGraphic(500, 20, FlxColor.BLACK);
funnySexBox.alpha = 0.35;
if (Preferences.extraScoreText) add(funnySexBox);

// The score text below the health bar.
if (Preferences.extraScoreText)
{
scoreText = new FlxText(0, healthBarBG.y + 30, FlxG.width, '', 16);
scoreText = new FlxText(0, healthBarBG.y + 40, FlxG.width, '', 16);
if (isFreyaSong) scoreText.setFormat(Paths.font('roboto/roboto.ttf'), 20, FlxColor.RED, CENTER);
else
scoreText.setFormat(Paths.font('vcr.ttf'), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE_FAST, FlxColor.BLACK);
Expand Down
35 changes: 23 additions & 12 deletions source/funkin/ui/options/ModMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class ModMenu extends Page

override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.R) {
if (FlxG.keys.justPressed.R)
{
refreshModList();
FunkinSound.playOnce(Paths.sound('cancelMenu'));
trace('Refreshed Mod List!');
Expand All @@ -46,29 +47,36 @@ class ModMenu extends Page

selections();

if (controls.UI_UP_P) {
if (controls.UI_UP_P)
{
selections(-1);
FunkinSound.playOnce(Paths.sound('scrollMenu'));
}

if (controls.UI_DOWN_P) {

if (controls.UI_DOWN_P)
{
selections(1);
FunkinSound.playOnce(Paths.sound('scrollMenu'));
}

if (FlxG.keys.justPressed.SPACE || FlxG.keys.justPressed.ENTER) {

if (FlxG.keys.justPressed.SPACE || FlxG.keys.justPressed.ENTER)
{
grpMods.members[curSelected].modEnabled = !grpMods.members[curSelected].modEnabled;
if (grpMods.members[curSelected].modEnabled) {
if (grpMods.members[curSelected].modEnabled)
{
FlxFlicker.flicker(grpMods.members[curSelected], 1.1, 0.0625, true, true);
FunkinSound.playOnce(Paths.sound('confirmMenu'));
trace('Enabled a mod!');
} else if (!grpMods.members[curSelected].modEnabled) {
}
else if (!grpMods.members[curSelected].modEnabled)
{
FunkinSound.playOnce(Paths.sound('cancelMenu'));
trace('Disabled a mod!');
}
}

if (controls.BACK) {
if (controls.BACK)
{
FunkinSound.playOnce(Paths.sound('cancelMenu'));
FlxG.switchState(() -> new OptionsState());
}
Expand Down Expand Up @@ -130,7 +138,7 @@ class ModMenu extends Page
var modMetadata:ModMetadata = detectedMods[index];
var modName:String = modMetadata.title;
var txt:ModMenuItem = new ModMenuItem(0, 10 + (40 * index), 0, modName, 48);
txt.setFormat(Paths.font('vcr.ttf'), 48, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
txt.setFormat(Paths.font('arial.ttf'), 48, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
txt.text = modName;
grpMods.add(txt);
}
Expand Down Expand Up @@ -158,9 +166,12 @@ class ModMenuItem extends FlxText

override function update(elapsed:Float)
{
if (modEnabled) {
if (modEnabled)
{
alpha = 1;
} else {
}
else
{
alpha = 0.5;
}
super.update(elapsed);
Expand Down

0 comments on commit d9692d3

Please sign in to comment.