topical media & game development

talk show tell print

mobile-query-three-plugins-ogsworkshop-examples-stage041.htm / htm



  <!doctype html><title>Minimal tQuery Page</title>
  <script src="../../../build/tquery-bundle-require.js"></script>
  <body><script>
  require(['tquery.keyboard', 'tquery.minecraft'], function(){
          // create the world, add the boilerplate and start
          var world        = tQuery.createWorld().boilerplate().start();
          // create the minecraft character
          var character        = tQuery.createMinecraftChar().addTo(world);
          character.object3D('root').translateY(-0.5);
          // simple hook
          world.loop().hook(function(delta, now){
                  var mesh        = character.object3D('root');
                  var keyboard        = tQuery.keyboard();
                  if( keyboard.pressed('left') )        mesh.translateX(-1 * delta)
                  if( keyboard.pressed('right') )        mesh.translateX(+1 * delta)
                  if( keyboard.pressed('up') )        mesh.translateZ(-1 * delta)
                  if( keyboard.pressed('down') )        mesh.translateZ(+1 * delta)
          });
  });
  </script></body>


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.