doodle/dev-assets/doodads/test/index.js
Noah Petherbridge 1e80304061 Initial Doodad JavaScript System
* Add the JavaScript system for Doodads to run their scripts in levels,
  and wire initial OnCollide() handler support.
* CLI: Add a `doodad install-script` command to the doodad tool.
  * Usage: `doodad install-script <index.js> <filename.doodad>`
* Add dev-assets folder for storing source files for the official
  default doodads, sprites, levels, etc. and for now add a JavaScript
  for the first test doodad.
2019-04-15 23:07:40 -07:00

14 lines
384 B
JavaScript

// Test Doodad Script
function main() {
console.log("I am actor ID " + Self.ID());
// Set our doodad's background color to pink. It will be turned
// red whenever something collides with us.
Self.Canvas.SetBackground(RGBA(255, 153, 255, 153));
Events.OnCollide( function(e) {
console.log("Collided with something!");
Self.Canvas.SetBackground(RGBA(255, 0, 0, 153));
});
}