Skip to content

Commit

Permalink
added zombie spawner
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Hulha committed Nov 22, 2013
1 parent ed9c85b commit 4b01d77
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions js/loadScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ require([
.then(null, function(e){
alert (e);
});

window.spawnZombie = function () {
var loader_ = new DynamicLoader({world: goo.world, rootPath: 'res'});
loader_.loadFromBundle('project.project', 'zombie.bundle').then( function() {
var z2 = loader_.getCachedObjectForRef("zombie_idle/entities/Zombie_Geo_0.entity");
z2.transformComponent.setTranslation(0,0,0);
z2.transformComponent.setUpdated();
z2.setComponent(new AIComponent(z2));
z2.aIComponent.addBehavior({name:"Zombie-Idle", update:ZombieIdle}, 0);
z2.aIComponent.addBehavior({name:"Zombie-PathFind", update:ZombiePathFind}, 1);
});
}

document.addEventListener('keypress', function(e){
if( e.keyCode == 114) { // r
spawnZombie();
}
}, false);

function initGoobers(goo){
console.log(loader._configs);
Expand Down

0 comments on commit 4b01d77

Please sign in to comment.