Where is the createInstanceOf() function?


#1

I’ve create a bullet clip and I’m trying to create instances of it through scripting (when the mouse is clicked). Reading the HOWTO on github says I should use createInstanceOf() function, but when I try it, i get a function not found error.


#2

Instead of instance, it’s clone in wick.

So here’s a simple bullet shoot script:

Inside of frame

var bullet = project.getObject(‘insert bullet name here’); // The bullet to instance
function shoot(obj) {
var newBullet = obj.clone();
newBullet.x = mouseX;
newBullet.y = mouseY;
}
function keyPressed(key) {
if (key == ‘F’) {
shoot(bullet);
}
}

Inside of bullet:

function update() {
if (this.isClone === true) {
this.y -= 3;
}
}

Basically what it does is:
var newBullet = project.getObject(‘bullet’).clone()


#3

Thank you!