I am trying to use a destroy function in a game I am developing to create a platform that is destroyed upon contact with the player. However, when I run the game and touch the block, the game crashes. The block also destroys everything below it.
I tried using different variables to execute the function but the same problem occurred I tried many different methods, yielding the same results.
Here is my current code:
const configBlockEvents = (block) => {
block.on("collide", (data) => {
const __player = data[1];
const __block = data[0];
if(__block.t === "+") {
nextLevel = true;
}
if(__block.t === "3") {
destroy(__block)
}