ShadowCaster.js 743 B

1234567891011121314151617181920212223242526272829303132
  1. var game = Atomic.game;
  2. var node = self.node;
  3. var body = node.createComponent("RigidBody2D");
  4. body.bodyType = Atomic.BT_STATIC;
  5. body.castShadows = true;
  6. var circle = node.createComponent("CollisionCircle2D");
  7. circle.radius = .35;
  8. var sprite2D = game.cache.getResource("Sprite2D", "Sprites/ball" + (Math.round(Math.random() * 7) + 1) + ".png");
  9. var sprite = node.createComponent("StaticSprite2D");
  10. sprite.setSprite(sprite2D);
  11. var x = -Light2DExample.halfWidth + (Light2DExample.halfWidth * 2) * Math.random();
  12. var y = -Light2DExample.halfHeight + (Light2DExample.halfHeight * 2) * Math.random();
  13. // tolerance towards the middle of screen
  14. x *= .7;
  15. y *= .7;
  16. node.position2D = [x, y];
  17. function start() {
  18. }
  19. function update(timeStep) {
  20. }