Copy link to clipboard
Copied
Ok so i'm making a game pac-man and i just couldnt understand the error they said my property hit was undefined but i don't know how its undefine if its already written in the code. Please help me Thank You In Advance
Error is: Line 52, Column31 1119: Access of possibly undefined property hit through a reference with static type as3.babyblue:Eater.
Where to find it is in Dots.as
Copy link to clipboard
Copied
Hi.
Try declaring this 'hit' property as a public property of the Eater class or try bracket notation:
if (hitTestObject(target["hit"]))
hideSelf();
And, of course, make sure you really have a 'hit' object inside of 'target'.
Please tell us if this works.
Regards,
JC
Copy link to clipboard
Copied
Yes it worked!!! Thank you so much
Copy link to clipboard
Copied
You're welcome!
Copy link to clipboard
Copied
Oh im sorry to trouble you but i got another error after inserting ["hit"]. I went on to fix the remaining errors but after control + enter they gave me
ReferenceError: Error #1069: Property hit not found on as3.babyblue.Eater and there is no default value.
at as3.babyblue::Dots/loop()
do u mind explaining it to me?
Copy link to clipboard
Copied
It means the solution didn't work. Haha You're receiving the same error.
Can you provide your FLA? Meanwhile, I'll uncheck my previous answer as the correct one.
Copy link to clipboard
Copied
Oh HAHAHA my bad i thought it worked since the error went away
Copy link to clipboard
Copied
Thank you!
The problem is that you don't have a object called 'hit' inside of the Baby Blue symbol (the one with the linkage as3.baby.Eater).
Turn that bitmap inside of it into a Movie Clip and give it a instance name of 'hit'.
But then we get another problem:
"Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds."
This is because of this function:
public static function crossPath(X:Number,Y:Number):Boolean
{
for (var k in myMap[0]) //This will make the map loop through it's 5 levels or rows, so the following code will run 5 times, once for each row.
{
if(myMap[0]
[0][0]==Y) {
for (var i in myMap[0]
[0]) //This will make the map loop through each column, remember this is already in the loop that goes to each row, so at this point every tile in the map will be looped through. {
if(i==0)
continue;
if(myMap[0]
[0]==X) {
return true;
break;
}
}
}
}
return false;
}//end of cross path
Probably you're getting a infine loop.
Please take a look and see if you can find out what's going on.
Copy link to clipboard
Copied
Can't seem to make it work still...
Copy link to clipboard
Copied
Do you mean the hit part or the function part?
Copy link to clipboard
Copied
The function part, i got the hit movie clip and placed it nested inside the Babyblue after that the error doesnt come out anymore im only stuck at the function part becus after loading the game, when the 2 ghost touched each other they completely freeze my Animate CC and crashes it....