main.js 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This script is the main entry point of the game
  2. require("AtomicGame");
  3. Atomic.game.init(start, update);
  4. // called at the start of play
  5. function start() {
  6. var game = Atomic.game;
  7. // create a 2D scene
  8. game.createScene3D();
  9. var scene = game.scene;
  10. // zone
  11. var zoneNode = scene.createChild("Zone")
  12. var zone = zoneNode.createComponent("Zone");
  13. zone.boundingBox = [-1000, -1000, -1000, 1000, 1000 , 1000];
  14. zone.ambientColor = [0.35, 0.35, 0.35];
  15. zone.fogColor = [0.1, 0.1, 0.1, 1.0];
  16. zone.fogStart = 10;
  17. zone.fogEnd = 100;
  18. game.cameraNode.position = [0, 1.0, -3];
  19. game.cameraNode.pitch(20);
  20. var lightNode = scene.createChild("Directional Light");
  21. lightNode.direction = [0.6, -1.0, 0.8];
  22. var light = lightNode.createComponent("Light")
  23. light.lightType = Atomic.LIGHT_DIRECTIONAL;
  24. var node = game.scene.createChild("RenderBox");
  25. node.createJSComponent("RenderBox");
  26. }
  27. // called per frame
  28. function update(timeStep) {
  29. }