The JavaCarrots scripting language supports the following commands:
The JavaCarrots scripting language is perhaps the most important ingredient to making a successful game. By combining the scripting commands together in the right combinations, it is possible to execute animations or implement game logic. For instance, the following script shows how to make an object named ``bunny'' in the document jump when clicked and eat a carrot when fed:
/** * Sample Bunny script. */ /* The bunny jumps when clicked. */ on click play boing.au move bunny 9 -28 delay 100 move bunny 9 -20 delay 100 move bunny 9 -12 delay 100 move bunny 9 -4 delay 100 move bunny 9 4 delay 100 move bunny 9 12 delay 100 move bunny 9 20 delay 100 move bunny 9 28 delay 100; /* The bunny eats any carrot dropped on it. */ on drop carrot play munch.au setimage bunny eatingbunny.gif delay 1000 setimage bunny normalbunny.gif;
Note that the final semicolon is not necessary as the semicolons serve only to separate clauses.