From 529ee0b0d232e0784fa7b3cb68be392b2f656698 Mon Sep 17 00:00:00 2001 From: PortilizenHub Date: Fri, 5 Aug 2022 14:25:42 -0500 Subject: [PATCH] 2022-8-5 --- CHANGELOG.md | 31 +++++- MODDING.md | 39 +++++++ Project.xml | 3 +- assets/preload/data/freeplaySonglist.txt | 1 - .../introMod/_append/data/introText.txt | 1 - example_mods/modList.txt | 1 - example_mods/readme.txt | 2 - iconMod/iconMod.txt | 1 + introMod/data/introTextMOD.txt | 3 + introMod/introMod.txt | 1 + source/AnimationDebug.hx | 6 +- source/ChartingState.hx | 4 +- source/FreeplayState.hx | 44 +++----- source/HealthIcon.hx | 6 + source/MainMenuState.hx | 8 +- source/ModSubState.hx | 103 ++++++++++++++++++ source/Note.hx | 3 +- source/OptionsSubState.hx | 23 ++-- source/Paths.hx | 8 +- source/PlayState.hx | 6 + source/TitleState.hx | 46 +++++--- source/_KeybindsSubState.hx | 79 -------------- 22 files changed, 267 insertions(+), 152 deletions(-) create mode 100644 MODDING.md delete mode 100644 assets/preload/data/freeplaySonglist.txt delete mode 100644 example_mods/introMod/_append/data/introText.txt delete mode 100644 example_mods/modList.txt delete mode 100644 example_mods/readme.txt create mode 100644 iconMod/iconMod.txt create mode 100644 introMod/data/introTextMOD.txt create mode 100644 introMod/introMod.txt create mode 100644 source/ModSubState.hx delete mode 100644 source/_KeybindsSubState.hx diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ad4806..baaaad2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Colored Health Bar - MP4 Cutscene Support -- Options Menu +- Full Options Menu - Fixed Monster Song - Week 7 -- Mod Support +- Full Mod Support - Arrow Color Changing - Not Hard-coded Events - Combo Hud @@ -23,10 +23,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Change Main Menu entirely - Change Main Menu Asset Fuctionality + +## [2022-8-5] +### Added +- Basic Options Menu with a Mods Menu (read MODDING.md) +- 2 Default Mods +- Paths.hx function to find folders +- check to see if health icon is null in health icon (if so the animation is set to null) +- Watermark in gameplay +### Changed +- How Tutorial is loaded +- Version system +- if the song characters in freeplay are null then it is the face icon instead of bf +- Main Menu BG scroll Factor +- Chart Editor Default Song +- animation debug gridBG to 16x16 instead of 10x10 +- note input thing a bit +### Removed +- Removed check if weeks are unlocked for weeks to be added ### Fixed -- Ninjamuffin_99's code +- Changelog for v2022-8-4 (version 1) AGAIN (im dumb) -## [0.2.0] - 2022-08-04 +## [2022-8-4] ### Added - Helpful Functions file shit - dialogue Background (doesnt do shit yet) @@ -43,9 +61,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Animation Debug Grid BG scroll factor ### Fixed -- Changelog for V0.1.0 +- Changelog for v2022-8-4 (version 1) -## [0.1.0] - 2022-08-04 +## [2022-8-4] +### Added - Miss Counter - Exit to Chart Editor - Exit to Freeplay and Exit to Story Mode diff --git a/MODDING.md b/MODDING.md new file mode 100644 index 0000000..dd2d3a8 --- /dev/null +++ b/MODDING.md @@ -0,0 +1,39 @@ +# QUICK MOD GUIDE + +With the v2022-8-5 update, I added a bit of a slightly nicer mod support backend. + +It's a system that requires some haxe experience. + +The basis of it is that you go to ModSubState.hx and add your mod stuff. +also with this system you can have multiple mods in one so yeah your welcome +:] + +it should look atleast something with these modifications + +line 6 to 7 in ModSubState.hx + +``` haxe +var modList:Array = ['myMod']; +var modListVAL:Array = [myModVAR]; +``` + +now the rest is up to you, but lets go on with it + +line 8 (or where ever you decide to put this var OUTSIDE THE FUNCTIONS) +``` haxe +public var myModVAR:Bool = false; +``` + +line 61 (or above, prob above 61 since you added new line(s)) +``` haxe +case "myMod": + if (myModVAR == false) + myModVAR = true; + else if (myModVAR == true) + myModVAR = false; +modListVAL.remove(myModVAR); +modListVAL.push(myModVAR); +trace('myMod: ' + myModVAR); +``` + +now comes to the part of adding your mod, depending on the mod you will need to modify different files, or a file. I cannot document this process since i dont know what kind of mod you want to make, but as long as you know haxe, you can do it, I beleive in you. diff --git a/Project.xml b/Project.xml index 32666ae..e8fbf70 100644 --- a/Project.xml +++ b/Project.xml @@ -2,7 +2,7 @@ - + @@ -90,7 +90,6 @@ - diff --git a/assets/preload/data/freeplaySonglist.txt b/assets/preload/data/freeplaySonglist.txt deleted file mode 100644 index 1b5bac2..0000000 --- a/assets/preload/data/freeplaySonglist.txt +++ /dev/null @@ -1 +0,0 @@ -Tutorial \ No newline at end of file diff --git a/example_mods/introMod/_append/data/introText.txt b/example_mods/introMod/_append/data/introText.txt deleted file mode 100644 index 45e0c08..0000000 --- a/example_mods/introMod/_append/data/introText.txt +++ /dev/null @@ -1 +0,0 @@ -swagshit--moneymoney \ No newline at end of file diff --git a/example_mods/modList.txt b/example_mods/modList.txt deleted file mode 100644 index 3e24925..0000000 --- a/example_mods/modList.txt +++ /dev/null @@ -1 +0,0 @@ -introMod \ No newline at end of file diff --git a/example_mods/readme.txt b/example_mods/readme.txt deleted file mode 100644 index f8d8f6e..0000000 --- a/example_mods/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -THIS MOD FOLDER DOES NOT ENTIRELY WORK JUST YET!!! -DONT EXPECT MUCH OUT OF IT RIGHT NOW!!! \ No newline at end of file diff --git a/iconMod/iconMod.txt b/iconMod/iconMod.txt new file mode 100644 index 0000000..65ec395 --- /dev/null +++ b/iconMod/iconMod.txt @@ -0,0 +1 @@ +icon mod is a mod that changes the icons alpha to be 0, aka blank in gameplay. \ No newline at end of file diff --git a/introMod/data/introTextMOD.txt b/introMod/data/introTextMOD.txt new file mode 100644 index 0000000..e1ea4eb --- /dev/null +++ b/introMod/data/introTextMOD.txt @@ -0,0 +1,3 @@ +swagshit--moneymoney +i--did it +mod stuff--wooooooooooooooooooooooooooooooooooooooooooooooooooooo \ No newline at end of file diff --git a/introMod/introMod.txt b/introMod/introMod.txt new file mode 100644 index 0000000..14fa0e5 --- /dev/null +++ b/introMod/introMod.txt @@ -0,0 +1 @@ +intro mod is a mod that modifies the intro text of the game \ No newline at end of file diff --git a/source/AnimationDebug.hx b/source/AnimationDebug.hx index 90381d4..fa6e619 100644 --- a/source/AnimationDebug.hx +++ b/source/AnimationDebug.hx @@ -24,6 +24,7 @@ class AnimationDebug extends FlxState var isDad:Bool = true; var daAnim:String = 'spooky'; var camFollow:FlxObject; + var gridBG:FlxSprite; public function new(daAnim:String = 'spooky') { @@ -35,7 +36,7 @@ class AnimationDebug extends FlxState { FlxG.sound.music.stop(); - var gridBG:FlxSprite = FlxGridOverlay.create(10, 10); + gridBG = FlxGridOverlay.create(16, 16); add(gridBG); if (daAnim == 'bf') @@ -111,6 +112,9 @@ class AnimationDebug extends FlxState override function update(elapsed:Float) { + gridBG.x = 0; + gridBG.y = 0; + textAnim.text = char.animation.curAnim.name; if (FlxG.keys.justPressed.E) diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 5638a0a..3ddcdff 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -134,10 +134,10 @@ class ChartingState extends MusicBeatState else { _song = { - song: 'Test', + song: 'Tutorial', notes: [], bpm: 150, - needsVoices: true, + needsVoices: false, player1: 'bf', player2: 'dad', speed: 1, diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 2c1132b..e0066a6 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -29,23 +29,22 @@ class FreeplayState extends MusicBeatState var selector:FlxText; var warning:FlxText; + private var iconArray:Array = []; private var grpSongs:FlxTypedGroup; private var curPlaying:Bool = false; override function create() { + + // FlxG.sound.destroy(); + // FlxG.sound.playMusic((Paths.music('freakyMenu')), 1, true); + warning = new FlxText(0, 0, 0, 'This song is not done, come back later when it is', 32); add(warning); warning.kill(); HelpfulVariables.songLoadedFromFreeplay = false; - var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); - - for (i in 0...initSonglist.length) - { - songs.push(new SongMetadata(initSonglist[i], 1, 'gf')); - } /* if (FlxG.sound.music != null) @@ -65,27 +64,17 @@ class FreeplayState extends MusicBeatState #if debug isDebug = true; #end - - if (StoryMenuState.weekUnlocked[2] || isDebug) - addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']); - - if (StoryMenuState.weekUnlocked[2] || isDebug) - addWeek(['Spookeez', 'South'], 2, ['spooky']); - - if (StoryMenuState.weekUnlocked[3] || isDebug) - addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']); - - if (StoryMenuState.weekUnlocked[4] || isDebug) - addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']); - - if (StoryMenuState.weekUnlocked[5] || isDebug) - addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']); - - if (StoryMenuState.weekUnlocked[6] || isDebug) - addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']); + + addSong('Tutorial', 1, 'gf'); + addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']); + addWeek(['Spookeez', 'South'], 2, ['spooky']); + addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']); + addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']); + addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']); + addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']); #if debug - addSong('test', 1, 'bf'); + addSong('test', 1, 'face'); #end // LOAD MUSIC @@ -173,7 +162,7 @@ class FreeplayState extends MusicBeatState public function addWeek(songs:Array, weekNum:Int, ?songCharacters:Array) { if (songCharacters == null) - songCharacters = ['bf']; + songCharacters = ['face']; var num:Int = 0; for (song in songs) @@ -278,10 +267,9 @@ class FreeplayState extends MusicBeatState function changeSelection(change:Int = 0) { #if !switch - NGio.logEvent('Fresh'); + NGio.logEvent(songs[curSelected].songName); #end - // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); curSelected += change; diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index ff967e9..6ed68af 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -12,8 +12,12 @@ class HealthIcon extends FlxSprite public function new(char:String = 'bf', isPlayer:Bool = false) { super(); + loadGraphic(Paths.image('iconGrid'), true, 150, 150); + if (ModSubState.iconModVAR == true) + alpha = 0; + antialiasing = true; animation.add('bf', [0, 1], 0, false, isPlayer); animation.add('bf-car', [0, 1], 0, false, isPlayer); @@ -35,6 +39,8 @@ class HealthIcon extends FlxSprite animation.add('monster', [19, 20], 0, false, isPlayer); animation.add('monster-christmas', [19, 20], 0, false, isPlayer); animation.play(char); + if (char == null) + animation.play('face'); scrollFactor.set(); } diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 56a416d..d48e9e6 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -25,7 +25,7 @@ class MainMenuState extends MusicBeatState var menuItems:FlxTypedGroup; - var optionShit:Array = ['story mode', 'freeplay', 'donate']; + var optionShit:Array = ['story mode', 'freeplay', 'donate', 'options']; var magenta:FlxSprite; var camFollow:FlxObject; @@ -51,7 +51,7 @@ class MainMenuState extends MusicBeatState var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBG')); bg.scrollFactor.x = 0; - bg.scrollFactor.y = 0.18; + bg.scrollFactor.y = 0.05; bg.setGraphicSize(Std.int(bg.width * 1.1)); bg.updateHitbox(); bg.screenCenter(); @@ -63,7 +63,7 @@ class MainMenuState extends MusicBeatState magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); magenta.scrollFactor.x = 0; - magenta.scrollFactor.y = 0.18; + magenta.scrollFactor.y = bg.scrollFactor.y; magenta.setGraphicSize(Std.int(magenta.width * 1.1)); magenta.updateHitbox(); magenta.screenCenter(); @@ -94,7 +94,7 @@ class MainMenuState extends MusicBeatState FlxG.camera.follow(camFollow, null, 0.06); - var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, Application.current.meta.get('version'), 12); + var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, 'v' + Application.current.meta.get('version'), 12); versionShit.scrollFactor.set(); versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(versionShit); diff --git a/source/ModSubState.hx b/source/ModSubState.hx new file mode 100644 index 0000000..b8468d4 --- /dev/null +++ b/source/ModSubState.hx @@ -0,0 +1,103 @@ +package; + +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.text.FlxText; +import flixel.util.FlxColor; + +class ModSubState extends MusicBeatSubstate +{ + var modList:Array = ['introMod', 'iconMod']; + var modListVAL:Array = [introModVAR, iconModVAR]; + + public static var introModVAR:Bool = false; + public static var iconModVAR:Bool = false; + public static var splitlsModVAR:Bool = false; + + var curSelected:Int = 0; + var grpOptionsTexts:FlxTypedGroup; + + public function new():Void + { + super(); + } + + override function create() + { + super.create(); + + grpOptionsTexts = new FlxTypedGroup(); + add(grpOptionsTexts); + + for (i in 0...modList.length) + { + var modText:FlxText = new FlxText(20, 20 + (i * 60), 0, modList[i] + ": " + modListVAL[i], 32); + modText.ID = i; + grpOptionsTexts.add(modText); + } + } + + override function update(elapsed:Float) + { + super.update(elapsed); + + modListVAL = [introModVAR, iconModVAR]; + + if (FlxG.keys.justReleased.ESCAPE) + FlxG.switchState(new MainMenuState()); + + if (controls.UP_P) + curSelected -= 1; + + if (controls.DOWN_P) + curSelected += 1; + + if (curSelected < 0) + curSelected = modList.length - 1; + + if (curSelected >= modList.length) + curSelected = 0; + + grpOptionsTexts.forEach(function(txt:FlxText) + { + txt.alpha = 0.5; + + if (txt.ID == curSelected) + txt.alpha = 1; + + txt.text = modList[txt.ID] + ": " + modListVAL[txt.ID]; + }); + + if (controls.ACCEPT) + { + switch (modList[curSelected]) + { + case "introMod": + if (introModVAR == false) + introModVAR = true; + else if (introModVAR == true) + introModVAR = false; + trace('introMod: ' + introModVAR); + + case "iconMod": + if (iconModVAR == false) + iconModVAR = true; + else if (iconModVAR == true) + iconModVAR = false; + trace('iconMod: ' + iconModVAR); + + /* + // was ment to be a mod that replaced the health icons with icons made by splitls + case "splitlsMod": + if (splitlsModVAR == false) + splitlsModVAR = true; + else if (splitlsModVAR == true) + splitlsModVAR = false; + trace('splitlsMod: ' + splitlsModVAR); + */ + + } + } + } +} diff --git a/source/Note.hx b/source/Note.hx index 114a7ff..020390c 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -173,9 +173,8 @@ class Note extends FlxSprite if (mustPress) { - // The * 0.5 is so that it's easier to hit them too late, instead of too early if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset - && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) + && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.8)) canBeHit = true; else canBeHit = false; diff --git a/source/OptionsSubState.hx b/source/OptionsSubState.hx index a4a98a8..9a9184f 100644 --- a/source/OptionsSubState.hx +++ b/source/OptionsSubState.hx @@ -8,7 +8,7 @@ import flixel.util.FlxColor; class OptionsSubState extends MusicBeatSubstate { - var textMenuItems:Array = []; + var textMenuItems:Array = ['Mods']; var selector:FlxSprite; var curSelected:Int = 0; @@ -19,19 +19,16 @@ class OptionsSubState extends MusicBeatSubstate { super(); - - FlxG.watch.addQuick("Selected", curSelected); - grpOptionsTexts = new FlxTypedGroup(); add(grpOptionsTexts); selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED); + add(selector); for (i in 0...textMenuItems.length) { - var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32); + var optionText:FlxText = new FlxText(20, 20 + (i * 80), 0, textMenuItems[i], 32); optionText.ID = i; - optionText.setFormat(Paths.font("vcr.ttf"), 64, FlxColor.WHITE); grpOptionsTexts.add(optionText); } } @@ -40,6 +37,9 @@ class OptionsSubState extends MusicBeatSubstate { super.update(elapsed); + if (FlxG.keys.justReleased.ESCAPE) + FlxG.switchState(new MainMenuState()); + if (controls.UP_P) curSelected -= 1; @@ -64,9 +64,14 @@ class OptionsSubState extends MusicBeatSubstate { switch (textMenuItems[curSelected]) { - case "Keybinds": - + case "Controls": + FlxG.state.closeSubState(); + FlxG.state.openSubState(new ControlsSubState()); + + case "Mods": + FlxG.state.closeSubState(); + FlxG.state.openSubState(new ModSubState()); } } } -} +} \ No newline at end of file diff --git a/source/Paths.hx b/source/Paths.hx index dcd1477..2791c8d 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -59,7 +59,7 @@ class Paths { return getPath('data/$key.txt', TEXT, library); } - + inline static public function xml(key:String, ?library:String) { return getPath('data/$key.xml', TEXT, library); @@ -105,6 +105,12 @@ class Paths return 'assets/fonts/$key'; } + + inline static public function folder(key:String, ?library:String) + { + return getPath('./$key', TEXT, library); + } + inline static public function getSparrowAtlas(key:String, ?library:String) { return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)); diff --git a/source/PlayState.hx b/source/PlayState.hx index 1dcd2c7..8fb74bf 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -755,6 +755,11 @@ class PlayState extends MusicBeatState hudTxt.scrollFactor.set(); add(hudTxt); + var waterTxt:FlxText = new FlxText(0, healthBarBG.y + 50, 0, "Cac-per Engine v2022.8.5", 20); + waterTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT); + waterTxt.scrollFactor.set(); + add(waterTxt); + strumLineNotes.cameras = [camHUD]; notes.cameras = [camHUD]; @@ -763,6 +768,7 @@ class PlayState extends MusicBeatState iconP1.cameras = [camHUD]; iconP2.cameras = [camHUD]; hudTxt.cameras = [camHUD]; + waterTxt.cameras = [camHUD]; doof.cameras = [camHUD]; // if (SONG.song == 'South') diff --git a/source/TitleState.hx b/source/TitleState.hx index 9306039..7c4f8c7 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -46,13 +46,18 @@ class TitleState extends MusicBeatState override public function create():Void { + FlxG.log.redirectTraces = true; + #if polymod - polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']}); + // polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']}); #end PlayerSettings.init(); - curWacky = FlxG.random.getObject(getIntroTextShit()); + if (ModSubState.introModVAR == false) + curWacky = FlxG.random.getObject(getIntroTextShit()); + else if (ModSubState.introModVAR == true) + curWacky = FlxG.random.getObject(getModIntroTextShit()); // DEBUG BULLSHIT @@ -218,19 +223,34 @@ class TitleState extends MusicBeatState } function getIntroTextShit():Array> - { - var fullText:String = Assets.getText(Paths.txt('introText')); - - var firstArray:Array = fullText.split('\n'); - var swagGoodArray:Array> = []; - - for (i in firstArray) { - swagGoodArray.push(i.split('--')); + var fullText:String = Assets.getText(Paths.txt('introText')); + + var firstArray:Array = fullText.split('\n'); + var swagGoodArray:Array> = []; + + for (i in firstArray) + { + swagGoodArray.push(i.split('--')); + } + + return swagGoodArray; } - return swagGoodArray; - } + function getModIntroTextShit():Array> + { + var fullText:String = Assets.getText('introMod/data/introTextMOD.txt'); + + var firstArray:Array = fullText.split('\n'); + var swagGoodArray:Array> = []; + + for (i in firstArray) + { + swagGoodArray.push(i.split('--')); + } + + return swagGoodArray; + } var transitioning:Bool = false; @@ -369,7 +389,7 @@ class TitleState extends MusicBeatState switch (curBeat) { case 1: - createCoolText(['portilizen', 'paul leps', 'bsod']); + createCoolText(['portilizen', 'paul leps', 'justy', 'gamersplitls', 'ferkeshu', 'bsod']); // credTextShit.visible = true; case 3: addMoreText('present'); diff --git a/source/_KeybindsSubState.hx b/source/_KeybindsSubState.hx deleted file mode 100644 index 673f7f8..0000000 --- a/source/_KeybindsSubState.hx +++ /dev/null @@ -1,79 +0,0 @@ -package; - -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.group.FlxGroup.FlxTypedGroup; -import flixel.text.FlxText; -import flixel.util.FlxColor; -import flixel.addons.ui.FlxInputText; - - -class _KeybindsSubState extends MusicBeatSubstate -{ - var textMenuItems:Array = ['LEFT', 'DOWN', 'UP', 'RIGHT']; - - var textMenuItemsINPUT:Array = []; - - var selector:FlxSprite; - var curSelected:Int = 0; - - var inputTextTest:FlxInputText; - - var grpOptionsTexts:FlxTypedGroup; - - public function new() - { - super(); - - inputTextTest = new FlxInputText(0, 0, 150, 'test', 16, FlxColor.BLACK, FlxColor.WHITE, true); - - grpOptionsTexts = new FlxTypedGroup(); - add(grpOptionsTexts); - - FlxG.watch.addQuick("Selected", curSelected); - - selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED); - - for (i in 0...textMenuItems.length) - { - var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32); - optionText.ID = i; - optionText.setFormat(Paths.font("vcr.ttf"), 64, FlxColor.WHITE); - grpOptionsTexts.add(optionText); - } - - } - - override function update(elapsed:Float) - { - super.update(elapsed); - - if (controls.UP_P) - curSelected -= 1; - - if (controls.DOWN_P) - curSelected += 1; - - if (curSelected < 0) - curSelected = textMenuItems.length - 1; - - if (curSelected >= textMenuItems.length) - curSelected = 0; - - grpOptionsTexts.forEach(function(txt:FlxText) - { - txt.color = FlxColor.WHITE; - - if (txt.ID == curSelected) - txt.color = FlxColor.YELLOW; - }); - - if (controls.ACCEPT) - { - switch (textMenuItems[curSelected]) - { - // code - } - } - } -} \ No newline at end of file