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.
This commit is contained in:
commit
8c19000603
13
dev-assets/doodads/test/index.js
Normal file
13
dev-assets/doodads/test/index.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// 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));
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user