I am a complete novice in CreateJS and I am using it to try and make a simple canvas game.
The user clicks a point on the screen and the sprite moves and stops. I have different display containers in this order (Stage children: path mesh, background, sprite container). Ideally the user clicks anywhere on the canvas and the sprite will move as far as possible until it reaches the edge of the path mesh png.
I just can't figure out how to achieve this. It would be great if someone could point me in the right direction to approach this problem. Many thanks.
Current snippet of code used.
client.walkmesh.addEventListener("click", function(evt) {
let pc = player.container
let timeline = new createjs.Timeline();
timeline.addTween(
// Bounce
createjs.Tween.get(playerChild, {loop:true})
.wait(1).to({
y:0,
}).wait(1).to({
y: -4,
}).wait(1).to({
y: -6,
}).wait(1).to({
y: -4,
}).wait(1).to({
y: 0,
}),
// Move
createjs.Tween.get(pc).to({x:evt.localX, y:evt.localY},
calculateSpeed(evt.localX, evt.localY, pc.x, pc.y),
createjs.Ease.linear)
);
});