Skip to content

Commit

Permalink
wowie credits is done!
Browse files Browse the repository at this point in the history
  • Loading branch information
khuonghoanghuy committed Dec 10, 2024
1 parent 2359299 commit 8e32483
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## v1.2 (Another small update but affect to gameplay)
- [X] Make a switch state when there have no mods folder inside them (like will move to `ActionState` when have no folder contains `meta.json` in the `mods` folder)
- [X] Display more thing on `About` state
- [ ] Add credits state on this engine (thought idk is should be?, but we will made mods can also add credits on them too)
- [X] Add credits state on this engine (thought idk is should be?, but we will made mods can also add credits on them too)
- [X] Edit more thing on `GameSelectionState` (still same)
- [X] Fix card display overlap the About State
- [X] Edit more thing on `ActionState`
Expand Down
24 changes: 24 additions & 0 deletions source/CreditsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import flixel.math.FlxMath;
import flixel.system.FlxAssets;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import sys.FileSystem;
import sys.io.File;

using StringTools;

class CreditsState extends FlxState
{
Expand Down Expand Up @@ -45,6 +49,9 @@ class CreditsState extends FlxState
camFollow.screenCenter(X);
add(camFollow);

for (mod in PolyHandler.getMods())
pushCredits(mod);

grpCredits = new FlxTypedGroup<FlxText>();
add(grpCredits);

Expand Down Expand Up @@ -125,4 +132,21 @@ class CreditsState extends FlxState
{
return creditsList[num].length <= 1;
}
function pushCredits(folder:String)
{
var file:String = Paths.file(folder + "/data/credits.txt", "mods");
trace(file);
if (FileSystem.exists(file))
{
var firstarray:Array<String> = File.getContent(file).split('\n');
for (i in firstarray)
{
var arr:Array<String> = i.replace('\\n', '\n').split("::");
if (arr.length >= 5)
arr.push(folder);
creditsList.push(arr);
}
creditsList.push(['']);
}
}
}

0 comments on commit 8e32483

Please sign in to comment.