Hi, I have this code written for a game im making, but the problem is that the function ‘jump’ is only run when the mouse is clicked over the movie clip “grape1”
I cant work out for the life of me why. Please help!
var MyArray = new Array
this.addEventListener(Event.ENTER_FRAME, keepRunning);
this.addEventListener(MouseEvent.CLICK, jump);
function keepRunning(event: Event) {
moveCurrent();
}
function moveCurrent() {
var speed = 12
var DiffY = mouseY - grape1.y
var DiffX = mouseX - grape1.x
var myRadians = Math.atan2(DiffY,DiffX);
var myDegrees = Math.round((myRadians * 180) / Math.PI)
var yMove = DiffY / speed
var xMove = DiffX / speed
grape1.y += yMove;
grape1.x += xMove
grape1.rotation = myDegrees+90;
}
function jump(event: Event) {
trace("F2")
}