| 12345678910111213141516171819202122232425262728293031323334353637 |
- // Atomic Component
- var game = Atomic.game;
- var scene = game.scene;
- var node = self.node;
- var daytime = true;
- function start() {
- // currently lightgroup must be created after viewport 0 is set
- var lightGroup = node.createComponent("Light2DGroup");
- lightGroup.setPhysicsWorld(Platformer.physicsWorld);
-
- if (daytime)
- lightGroup.ambientColor = [1, 1, 1, 1];
- else
- lightGroup.ambientColor = [.8, .8, .8, .25];
-
-
- if (daytime)
- {
- TheSun = scene.createComponent("DirectionalLight2D");
- TheSun.color = [1, 1, 1, 0.15];
- TheSun.castShadows = true;
- TheSun.numRays = 1024;
- TheSun.backtrace = false;
- lightGroup.addLight(TheSun);
- }
- }
- function update(timeStep) {
- }
|