main.js 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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, 2.5, -6];
  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. // create the game component
  25. var node = game.scene.createChild("Chest");
  26. node.createJSComponent("Chest");
  27. }
  28. // called per frame
  29. function update(timeStep) {
  30. }