main.js 637 B

123456789101112131415161718192021222324252627282930
  1. // This script is the main entry point of the game
  2. require("AtomicGame");
  3. // bring in our native plugin
  4. var NativePlugin = require("MyNativePlugin");
  5. Atomic.game.init(start, update);
  6. // called at the start of play
  7. function start() {
  8. // call our native method
  9. var answer = NativePlugin.getAnswer();
  10. print("The answer is: ", answer, " which is " , NativePlugin.checkAnswer(answer) ? "correct" : "incorrect");
  11. var game = Atomic.game;
  12. // create a 2D scene
  13. game.createScene2D();
  14. var spaceNode = game.scene.createChild("Star");
  15. spaceNode.createJSComponent("Star");
  16. }
  17. // called per frame
  18. function update(timeStep) {
  19. }