I'm working on a createjs game where an image is held inside of a container. I want to tween the image to a location on the screen and switch the image to another image. After a number of seconds pass, I want to remove the new image from the canvas/screen.
Currently, I'm passing an (evt) into the function, but the other games/examples all don't bother with this part?
It works in the first .call function, but the part where I commented out after the .wait and the second .call does not work. Suddenly, TheThingBeingTweened is undefined?
Any tip in the right direction should be helpful.
createjs.Tween
.get(inkContainer, {onChange: onInkContainerTweenChange})
.to({
y: playerContainer.y + (Math.random() * 200 - 100),
x: playerContainer.x + (Math.random() * 200)
}, 8000)
.call(function (evt) {
var theThingBeingTweened = evt.target;
//self.stage.removeChild(theThingBeingTweened);
var theContainer = theThingBeingTweened.parent;
theContainer.removeChild(theThingBeingTweened);
splatContainer = new createjs.Container();
splat = new
createjs.Bitmap(queue.getResult("splat"));
splatContainer.addChild(splat);
splatContainer.x = theThingBeingTweened.x;
splatContainer.y = theThingBeingTweened.y;
theContainer.addChild(splatContainer);
});
//.wait(3000)
//.call(function (evt) {
// var theThingBeingTweened = evt.target;
// self.stage.removeChild(theThingBeingTweened);
//});