Skip to content

Commit

Permalink
Merge pull request #280 from RSamaium/v4.2.2
Browse files Browse the repository at this point in the history
V4.2.2
  • Loading branch information
RSamaium committed Jan 15, 2024
2 parents cb34156 + 9b06af1 commit 467327f
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 46 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const guideMenu = [{
{ text: "Create event (NPC)", link: "/guide/create-event" },
{ text: "Create items", link: "/guide/create-database" },
{ text: "Create shape", link: "/guide/create-shape" },
{ text: "Add music in map", link: "/guide/create-sound" },
{ text: "Create animated tile", link: "/guide/animation-tile" },
{ text: "Save the player's progress", link: "/guide/save" },
{ text: "Production", link: "/guide/production" },
Expand Down
44 changes: 40 additions & 4 deletions docs/guide/create-sound.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
# Step 8. Put sounds and music
# Put sounds and music

## Prerequisites
<div class="autoload-api">

1. You must have an sound
## Structure

Here is the structure:

* main
* sounds
* town.(mp3|ogg)

## Add sound in map

To quickly add a sound, add a personality property to the map (in Tiled Map Editor) named sounds. Put the sound ID of the resource

![tiled world](/assets/map-sound.png)



## Parameters of the sound (optional)

Add a file named `town.ts` in the directory `sounds` and add the following code:

```ts
import { Sound } from '@rpgjs/client'

@Sound({
sounds: {
town: require('./town.mp3'),
},
loop: true
})
export class TownMusic {}
```

More information on the parameters: [Sound Class](/classes/sound.html)

</div>
<div class="module-api">

## Structure

Expand Down Expand Up @@ -61,4 +96,5 @@ import { RpgMap, MapData } from '@rpgjs/server'
sounds: ['town'] // You can add several musics
})
export class MedievalMap extends RpgMap { }
```
```
</div>
6 changes: 0 additions & 6 deletions docs/guide/create-world-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ Just add JSON file in <PathTo to="baseModule" file="worlds/myworld.world" />
The world creates maps automatically and the map ID will be the file name. Be aware that if you already have a map with the same ID, the world will use this map
:::

::: tip
To quickly add a sound, add a personality property to the map (in Tiled Map Editor) named sounds. Put the sound ID of the resource, client side (see [Create Sound](/guide/create-sound.html))

![tiled world](/assets/map-sound.png)
:::

## Bonus. Prevent map change

There are several reasons for this. For example,
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/RpgClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export interface RpgClient {
* @example
*
* ```ts
* import { RpgClient, RpgModule } from '@rpgjs/server'
* import { RpgClient, RpgModule } from '@rpgjs/client'
*
* @RpgModule<RpgClient>({
* hooks: {
Expand All @@ -198,7 +198,7 @@ export interface RpgClient {
* And listen to the hook:
*
* ```ts
* import { RpgClientEngineHooks, RpgSprite } from '@rpgjs/server'
* import { type RpgClientEngineHooks, RpgSprite } from '@rpgjs/client'
*
* const sprite: RpgSpriteHooks = {
* onAuth(player: RpgSprite) {
Expand Down
66 changes: 33 additions & 33 deletions packages/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"pretty-error": "^4.0.0",
"rxjs": "7.8.0",
"sat": "^0.9.0",
"simple-room": "^3.1.2",
"simple-room": "^3.1.3",
"socket.io": "^4.6.1"
},
"gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee",
Expand Down

0 comments on commit 467327f

Please sign in to comment.