I have a code for a character and a Jelly.
Character:
up_btn.addEventListener(MouseEvent.CLICK, function(){
character.y-=10;
})
down_btn.addEventListener(MouseEvent.CLICK, function(){
character.y+=10;
})
left_btn.addEventListener(MouseEvent.CLICK, function(){
character.x+=10;
})
right_btn.addEventListener(MouseEvent.CLICK, function(){
character.x-=10;
})
Jelly:
var JellyHitted:Boolean;
function hitJelly(e: Event):void {
if (character.hitTestObject(Jelly1)) {
JellyHitted = true;
character.gotoAndStop(7);
if (character.electrocuted.currentFrame == 30) {
character.gotoAndStop(1);
}
}
else{
JellyHitted = false;
}
Jelly Test Any ideas how to keep a character until it hits the jelly?