Version 4:
Where should I place my map1.ts
file to catch onLoad
event? Or how to configure this?
import { MapData, RpgMap } from "@rpgjs/server";
import Zombie from "./../../events/mobs/zombie";
import { Spawn } from './../../spawn/Spawn';
// @ts-ignore
@MapData({
id: 'map1',
file: require('./map1.tmx'),
events: [Zombie]
})
class Map1 extends RpgMap {
onLoad() {
console.log('loaded')
const spawns = new Spawn(this.getShapes(), this);
spawns.populate();
}
}
export default Map1;
I tried with:
{project}/map1.ts
{project}/maps/map1.ts
{project}/worlds/maps/map1.ts