doodle/dev-assets/doodads/objects/exit-flag.js
Noah Petherbridge 4d08bf1d85 Switch JavaScript engine to goja
* Switch from otto to goja for JavaScript engine.
* goja supports many ES6 syntax features like arrow functions,
  const/let, for-of with more coming soon.
* Same great features as otto, more modern environment for doodads!
2022-01-16 20:09:27 -08:00

20 lines
265 B
JavaScript

// Exit Flag.
function main() {
Self.SetHitbox(22 + 16, 16, 75 - 16, 86);
Events.OnCollide((e) => {
if (!e.Settled) {
return;
}
// Only care if it's the player.
if (!e.Actor.IsPlayer()) {
return;
}
if (e.InHitbox) {
EndLevel();
}
});
}