Ask coding questions

← Back to all posts
Kaboom.js
mrslep (30)

How do you make something like this:
if (gamecharacter) collides with (enemy) it dies?

Answered by Coder100 (18930) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18930)

use collide

collides("player", "enemy", () => {
  // your code
});

this is assuming that when you create them, you have:

add(["player", ....]);
add(["enemy", ....])