Skip to content

Commit

Permalink
card code yoo
Browse files Browse the repository at this point in the history
  • Loading branch information
khuonghoanghuy committed Dec 8, 2024
1 parent 923a93a commit dd0d037
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# List TODO for Cruese Engine
## v1.1 (Small Updated)
- [ ] Add a Cart display game onto `GameSelectionState`
- [ ] Add a card display game onto `GameSelectionState` (it likely display cartridge)
- [X] Add a crash handler
- [X] Add a `About` class

Expand Down
Binary file added assets/images/gameUI/cardGameMissing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/Setup-Game.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Note that this file is required!
### Put icon (optional)
If you wanna add a icon, make one and save this image as name `icon.png` and put in your mods game like `mods/<your game>/icon.png`

### Put card to display (optional)
Display more thing idk how to say

Also the image icon should recommended at `150x150` though the game will auto resize them to only `75x75`

## Result (TADA)
Expand Down
19 changes: 18 additions & 1 deletion source/GameSelectionState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class GameSelectionState extends FlxState
var camFollow:FlxObject;
var desc:FlxText;
var iconGame:Array<ModIcon> = [];
var cardGame:FlxSprite;

override function create()
{
Expand All @@ -37,6 +38,7 @@ class GameSelectionState extends FlxState
PolyHandler.reload();

// i think this goes after PolyHandler.reload??
// it should be checked mods folder, it don't have any folder that contains `meta.json` then move to ActionState with the task is `missing folder`
/* if (!PolyHandler.trackedMods.length > 0)
{
persistentUpdate = false;
Expand Down Expand Up @@ -86,7 +88,13 @@ class GameSelectionState extends FlxState
desc.cameras = [camHUD];
add(desc);

var versionDisplay:FlxText = new FlxText(1, 1, 0, "Press F1 For display some about thing", 16);
cardGame = new FlxSprite(0, 0, Paths.image("gameUI/cardGameMissing"));
cardGame.screenCenter(XY);
cardGame.cameras = [camHUD];
cardGame.x += 125;
add(cardGame);

var versionDisplay:FlxText = new FlxText(1, 1, 0, "Press F1 to display ABOUT", 16);
versionDisplay.setFormat(FlxAssets.FONT_DEFAULT, 16, FlxColor.WHITE, FlxTextAlign.LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
versionDisplay.cameras = [camHUD];
add(versionDisplay);
Expand Down Expand Up @@ -145,6 +153,15 @@ class GameSelectionState extends FlxState
{
desc.text = PolyHandler.trackedMods[curSelected].description;
}
try
{
cardGame.loadGraphic(PolyHandler.trackedMods[curSelected].modPath + "/cardGame.png");
}
catch (e:Dynamic)
{
FlxG.log.warn(e);
cardGame.loadGraphic(Paths.image('gameUI/cardGameMissing'));
}
}
}

Expand Down

0 comments on commit dd0d037

Please sign in to comment.