Roboman.js 877 B

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