RoboMan.js 732 B

123456789101112131415161718192021222324252627282930313233
  1. var game = Atomic.game;
  2. var node = self.node;
  3. RoboMan = self;
  4. function start() {
  5. var cache = game.cache;
  6. var model = node.createComponent("AnimatedModel");
  7. model.setModel(cache.getResource("Model", "Models/RoboMan.mdl"));
  8. model.setMaterial(cache.getResource("Material", "Materials/Robot_01_Diffuse.xml"));
  9. model.castShadows = true;
  10. var animCtrl = node.createComponent("AnimationController");
  11. animCtrl.playExclusive("Models/RoboMan_Normal_Run.ani", 0, true, 0.0);
  12. game.cameraNode.position = [0, 5.5, -10];
  13. game.cameraNode.pitch(20);
  14. node.yaw(180);
  15. }
  16. // we need an update or it doesn't run the start, fix in JSVM
  17. function update(timeStep) {
  18. node.yaw(timeStep * 100);
  19. }