I have a catapult ball i want it to go from postion a to postion b than hit a wall which explodes only when the ball hits it.
I need a button for the user to press or a tick box, so for example a tick plays the animation once and unticking it resets the animation. I was told i could keyframe but have no idea how to,
heres the code i use at the moment that’s a increases speed for a ball that moves from left to right.
var controls = new function() {
this.wallexplosionSpeed = 0.00;
this.catapultballSpeed = 0.00;
}
keys.add(controls, 'wallexplosionSpeed', 0, 0.5);
keys.add(controls, 'catapultballSpeed', 0, 0.5);
function render() {
angle += controls.catapultballSpeed;
catapultball.position.x = 12 + (10 * (Math.cos(angle)));
catapultball.position.y = 2 + (10 * Math.abs(Math.sin(angle)));
}