Welcome to the forum
Yes, in a way, you have to dive into PixiJS if you want to render
But some parts are simplified. For example, to display the name above the player:
src/modules/main/client/sprite.ts
:
import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client'
declare module '@rpgjs/client' {
export interface RpgSprite {
textGraphic: PIXI.Text
}
}
export const sprite: RpgSpriteHooks = {
onInit(sprite: RpgSprite) {
const style = new PIXI.TextStyle({
fontSize: 14,
fontWeight: 'bold'
})
const textGraphic = new PIXI.Text('', style)
textGraphic.y = -25
textGraphic.anchor.set(0.5)
sprite.textGraphic = textGraphic
sprite.addChild(textGraphic)
},
onChanges(sprite: RpgSprite, data: any) {
if (data && data.name) {
const name = data.name
// To center the text...
sprite.textGraphic.x = name.length + 12
sprite.textGraphic.text = name
}
}
}
If you change the name on the server side
// server side
player.name = 'Hero'
