I´m working on a top down racing game, and have been designing my levels in Tiled. I have an Object Layer with checkpoints that will be used to check if the player is going in the right direction and to navigate ai racers.
I´ve been able to import the map and add physics and collisons to the regular Tile Layers, and I have gotten the objects from Tiled in to an array using getObjectLayer(), but I can´t figure out what to do with them to make them them register collisions. I´ve tried looping through the array and adding them as gameObject to matter like this:
checkpoints.objects.forEach(checkpoint => {
this.matter.add.gameObject(checkpoint);
});
but I get an error message:
“Uncaught TypeError: i.gameObject.emit is not a function”
Could someone please tell me how to add gameObjects and have them collide the correct way?