topical media & game development
mobile-query-three-plugins-minecraft-tquery.minecraftchar.keyboard2.js / js
tQuery.registerStatic('createMinecraftCharKeyboard2', function(opts){
return new tQuery.MinecraftCharKeyboard2(opts)
});
tQuery.registerStatic('MinecraftCharKeyboard2', function(opts){
// display obsolete messaage
console.warn('tQuery.MinecraftCharKeyboard2 is obsolete. prefere tQuery.MinecraftCharControl')
// handle parameters polymorphism
if( opts instanceof THREE.Object3D ) opts = { object3D: opts };
if( opts instanceof tQuery.Object3D ) opts = { object3D: opts.get(0) };
if( opts.object3D instanceof tQuery.Object3D ) opts.object3D = opts.object3D.get(0)
// handle default values
opts = this._opts = tQuery.extend(opts, {
world : tQuery.world,
lateralMove : 'rotationY'
});
// sanity check
console.assert( opts.object3D instanceof THREE.Object3D )
console.assert( ['strafe', 'rotationY'].indexOf(opts.lateralMove) !== -1 );
// user control
this._onLoop);
}
tQuery.MinecraftCharKeyboard2.prototype.opts = function(){
return this._opts;
}
(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.