Skip to content

Commit

Permalink
update docs and small refactors/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Nov 17, 2024
1 parent a5540ba commit 0c56eaa
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 65 deletions.
19 changes: 13 additions & 6 deletions docs/01 - scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ This will teach you how to use Rhythmo's special scripting system. Basically, yo
Your script should either be located in `assets/scripts/[name].hxs`, or in `assets/songs/[song-name]/[name].hxs`. <br>
However, if your script is a scripted state or substate, it should be located in `assets/classes/[name].hxs`.

**NOTE: These Haxe syntaxes are not supported**:
* `package`
* `import` (there's another function that emulates the purpose of this function)
* `class`
* `typedef`
* `metadata`
## Limitations
The following are not supported:
* Keywords:
* `package`
* `import` (there's another function that emulates the purpose of this function)
* `class`
* `typedef`
* `metadata`
* `final`
* Wildcard imports
* Access modifiers (e.g., `private`, `public`)
* Multi-line comments (`/* ... */`)


## Default Variables
* `Function_Stop` - Cancels functions (e.g., `startCountdown`, `endSong`).
Expand Down
50 changes: 28 additions & 22 deletions docs/02 - adding-a-custom-song.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
# How to Add a Custom Song
This will teach you how to add your own song to the game. Really, it's pretty simple.
This will teach you how to add your own song to the game.

## Adding your Song
First of all, you need to add your song to the Song Selection Menu. <br>
To do that, go to `assets/songs.json`. Then, to add your song, use this template:
```json
{
"name": "Song Name",
"diff": 1
}
```

Now, to add your song's cover, it should be in `assets/images/covers/[song-name].png`. <br>
Keep in mind, your song name should be lowercase and any spaces should be replaced with a dash. <br>
Also, the size of your cover should be a square, preferably `720 by 720`.
## Song Audio
First of all, you need your song's audio. You only need an audio file with your music called `music.ogg`. <br>
It should be located in `assets/songs/[song-name]/music.ogg`.

## Adding Song Data
For song data, you need the following:
* `assets/songs/[song-name]/chart.json`
* `assets/songs/[song-name]/music.ogg`

For your chart, use this empty template:
## Song Data
Now, you need your chart. <br>
For your chart, copy this empty template:
```json
{
"song": "Song Name",
Expand All @@ -29,10 +16,29 @@ For your chart, use this empty template:
"timeSignature": [4, 4]
}
```
It should be called `chart.json` and should be located in `assets/songs/[song-name]/chart.json`.

## Charting
### Charting
To chart your song, go to `PlayState.hx` and then press "7" to go to ChartingState. <br>
Or you can go to your song in `SongSelectState.hx`, and use `SHIFT + ENTER`.

When you're done, simply save the chart by using `Save Chart` or `Save Chart As`. <br>
Denpending on what you choose, it should save in `assets/songs/[song-name]/chart.json` or `./[song-name].json`.
Denpending on what you choose, it should save in `assets/songs/[song-name]/chart.json` or `./[song-name].json`.

## Adding your Song to the Song Selection Menu
To add your song to the Song Selection Menu, go to `assets/songs.json`. <br>
Then, to add your song, use this template:
```json
{
"name": "Song Name",
"diff": 1
}
```

Now, for your song's cover, it should be in `assets/images/covers/[song-name].png`. <br>
Keep in mind, your song's name should be lowercase and any spaces should be replaced with a dash. <br>
Also, the size of your cover should be a square, preferably `720 by 720`.

## Adding a Script (Optional)
Additionally, you also add in a script that will only run on a specific song. <br>
See [Scripting](https://github.com/Joalor64GH/Rhythmo-SC/blob/main/docs/01%20-%20scripting.md) for more.
4 changes: 2 additions & 2 deletions docs/03 - adding-a-custom-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This is another simple tutorial on how to add a custom language.

## Adding your Language
Firstly, you need to edit these two main text files:
* `assets/languages/languagesList.txt` - Your list of languages. (de, en, es, fr, and so on...)
* `assets/languages/languagesList.txt` - Your list of languages. (e.g., `de`, `en`, `es`, `fr`)
* `assets/languages/languagesData.txt` - This is so that your language can be pushed into `LanguagesState.hx`.

To add your language into `languagesData.txt`, use this format:
Expand All @@ -16,6 +16,6 @@ So, for example, if you wanted to add German, it would look like:
Deutsch (Deutschland):de
```

Now, you need your `.json` file, which should be located in `assets/languages/[language-code].json`.
Now, you need your `.json` file, which should be located in `assets/languages/[language-code].json`. <br>
Of course, this contains the data for your language. <br>
To add your data, just copy [this](/assets/languages/en.json), and edit it with your translations.
40 changes: 29 additions & 11 deletions docs/04 - adding-a-mod.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# How to Add a Mod
This tutorial simply shows you how you can add your own mod.

## Creating the Folder
Create a folder in the `mods` folder and rename it to whatever you want.

## Creating a Folder
Create a folder in the `mods` folder and rename it to whatever you want. <br>
Doing this manually isn't a problem, but it would be better and faster if you copy-and-pasted the Template.

![](https://github.com/user-attachments/assets/85d6cc54-72e0-406f-b5a0-131b65e32b62?raw=true)
![](https://github.com/user-attachments/assets/add932d1-8a09-40c8-ae2a-89d57ca1c9cf?raw=true)

## In-Game Mod Info

The info for a mod is stored in two files. Those two files are `_polymod_meta.json` and `_polymod_icon.png`.
## Mod Metadata
The mod metadata comes in two files. Those two files are `_polymod_meta.json` and `_polymod_icon.png`.

### `_polymod_meta.json`
### `_polymod_meta.json` (Required)
In `_polymod_meta.json`, you can define the mod name, the name of the author, etc.

Example:
Expand All @@ -28,14 +26,34 @@ Example:
}
```

### `_polymod_icon.png`
As for `_polymod_icon.png`, it's just a simple `.png` icon for the mod. Any square image is recommended. Just keep in mind that **whatever image it is, it will always be squished into a `75 x 75` resolution**.
### `_polymod_icon.png` (Optional)
As for `_polymod_icon.png`, it's just a simple `.png` icon for the mod. Any square image is recommended, preferably `150 x 150`. Just keep in mind that **whatever image it is, it will always be squished into a `75 x 75` resolution**.

If you've done everything correctly, your mod should appear in the Mods Menu. <br>
Then, you're basically good to go!

## Mod Structure
Each folder in your mod should be used as follows:
* `_append` - Modify existing files without actually replacing them.
* `achievements` - For storing achievement data. Each achievement should be listed in `achList.txt`.
* `classes` - Scripted States and Substates.
* `fonts` - Font files. Pretty self-explanatory.
* `images` - All images in your mod.
* `images/achievements` - The icons for your achievemnts.
* `images/covers` - The covers for your songs.
* `images/credits` - Used for credit icons.
* `images/gameplay` - Used for gameplay UI.
* `images/menu` - Used for menu assets.
* `languages` - For storing language data.
* `music` - Non-gameplay related music.
* `scripts` - Scripts that run on every song.
* `songs` - Songs used for gameplay.
* `songs/[song-name]/chart.json` - Your song's chart.
* `songs/[song-name]/music.ogg` - Your song's music. Can also be a `.wav`.
* `songs/[song-name]/[script-name].hxs` - Song-specific script (optional).
* `sounds` - All sound effects.

For further documentation, check out [polymod.io](https://polymod.io/docs/).

## Quick Example

Here's a quick example by [EliteMasterEric](https://twitter.com/EliteMasterEric) » [here](https://github.com/EnigmaEngine/ModCore-Tricky-Mod) «
Here's a quick example by [EliteMasterEric](https://twitter.com/EliteMasterEric) » [here](https://github.com/EnigmaEngine/ModCore-Tricky-Mod) «
2 changes: 1 addition & 1 deletion docs/05 - adding-custom-credits.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
If you want to add your own credits to `CreditsState.hx`, this will show you how to.

## Adding Custom Credits
To add your custom credits, you first need to navigate to `assets/credits.json`. <br>
To add your custom credits, you first need to go to `assets/credits.json`. <br>
Then you can edit the following:
* `menuBG` - Your custom menu background.
* `menuBGColor` - The color of your custom background (`[R, G, B]`).
Expand Down
7 changes: 3 additions & 4 deletions source/options/ControlsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,11 @@ class ControlsSubState extends ExtendableSubState {
if (Input.justPressed('any')) {
if (gamepadMode) {
var keyPressed:FlxGamepadInputID = gamepad.firstJustPressedID();
if (gamepad != null && keyPressed.toString() != FlxGamepadInputID.NONE) {
if (gamepad != null && keyPressed.toString() != FlxGamepadInputID.NONE)
SaveData.settings.gamepadBinds[curSelected] = keyPressed;
}
} else {
} else
SaveData.settings.keyboardBinds[curSelected] = FlxG.keys.getIsDown()[0].ID.toString();
}

SaveData.saveSettings();
Input.refreshControls();
FlxG.sound.play(Paths.sound('select'));
Expand Down
6 changes: 1 addition & 5 deletions source/states/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,7 @@ class ChartingState extends ExtendableState {
var snappedGridSize = (gridSize / (beatSnap / Conductor.stepsPerSection));

dummyArrow.x = Math.floor(FlxG.mouse.x / gridSize) * gridSize;

if (Input.pressed('shift'))
dummyArrow.y = FlxG.mouse.y;
else
dummyArrow.y = Math.floor(FlxG.mouse.y / snappedGridSize) * snappedGridSize;
dummyArrow.y = (Input.pressed('shift')) ? FlxG.mouse.y : Math.floor(FlxG.mouse.y / snappedGridSize) * snappedGridSize;
}

if (FlxG.mouse.justPressed) {
Expand Down
7 changes: 5 additions & 2 deletions source/states/EditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class EditorState extends ExtendableState {
daText = new FlxText(5, FlxG.height - 24, 0, "", 12);
daText.setFormat(Paths.font('vcr.ttf'), 20, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(daText);

changeSelection(0, false);
}

override function update(elapsed:Float) {
Expand All @@ -46,8 +48,9 @@ class EditorState extends ExtendableState {
}
}

private function changeSelection(change:Int = 0) {
FlxG.sound.play(Paths.sound('scroll'));
private function changeSelection(change:Int = 0, ?playSound:Bool = true) {
if (playSound)
FlxG.sound.play(Paths.sound('scroll'));
curSelected = FlxMath.wrap(curSelected + change, 0, options.length - 1);
grpOptions.forEach(function(txt:FlxText) {
txt.alpha = (txt.ID == curSelected) ? 1 : 0.6;
Expand Down
2 changes: 1 addition & 1 deletion source/states/InitialState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class InitialState extends ExtendableState {

trace('current platform: ${PlatformUtil.getPlatform()}');

#if (desktop || UPDATE_CHECK)
#if (desktop && UPDATE_CHECK)
UpdateState.updateCheck();
#else
trace('Sorry! No update support on: ${PlatformUtil.getPlatform()}!');
Expand Down
11 changes: 4 additions & 7 deletions source/states/ModsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,12 @@ class ModsState extends ExtendableState {
mustResetMusic = true;
ExtendableState.switchState(new MenuState());
} else if (Input.justPressed('accept')) {
if (!FlxG.save.data.disabledMods.contains(ModHandler.trackedMods[curSelected].id)) {
if (!FlxG.save.data.disabledMods.contains(ModHandler.trackedMods[curSelected].id))
FlxG.save.data.disabledMods.push(ModHandler.trackedMods[curSelected].id);
FlxG.save.flush();
changeSelection();
} else {
else
FlxG.save.data.disabledMods.remove(ModHandler.trackedMods[curSelected].id);
FlxG.save.flush();
changeSelection();
}
FlxG.save.flush();
changeSelection();
}
}

Expand Down
8 changes: 4 additions & 4 deletions source/substates/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class PauseSubState extends ExtendableSubState {
override function update(elapsed:Float) {
super.update(elapsed);

if (isTweening) {
tipTxt.screenCenter(X);
tipTxt.screenCenter(X);

if (isTweening)
timer = 0;
} else {
tipTxt.screenCenter(X);
else {
timer += elapsed;
if (timer >= 3)
changeText();
Expand Down

0 comments on commit 0c56eaa

Please sign in to comment.