Hello,
I am having a small issue that has been plaguing me for too long. I have this code below:
var Gamemanager = pc.createScript('gamemanager');
var shuffleObjects;
var chosenObject;
var cloneMaterial;
var testBool;
// initialize code called once per entity
Gamemanager.prototype.initialize = function() {
shuffleObjects = this.app.root.findByTag("SO");
this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onSelect, this);
this.timer = 0;
this.isTimerActive = false;
this.testBool = false;
};
Gamemanager.prototype.ColorChange = function(event){
chosenObject = shuffleObjects[Math.floor(Math.random() * shuffleObjects.length)];
cloneMaterial = chosenObject.model.meshInstances[0].material.clone();
chosenObject.model.meshInstances[0].material = cloneMaterial;
cloneMaterial.diffuse.set(1,1,0,1);
cloneMaterial.update();
this.isTimerActive = true;
};
// update code called every frame
Gamemanager.prototype.update = function(dt) {
if(!this.isTimerActive)
return;
this.timer += dt;
if (this.timer > 2) {
cloneMaterial.diffuse.set(1,1,1,1);
cloneMaterial.update();
// Reset the timer
this.timer = 0;
this.isTimerActive = false;
Gamemanager.MoveObjects();
}
};
Gamemanager.prototype.MoveObjects = function(){
console.log("Im here");
};
When I launch this project, I get the error that MoveObjects is undefined almost as if it doesn’t recognize it as a function. Not sure whats wrong here at all. Any help would be appreciated.