-
1. Re: Hello, I am trying to write a small game i
moccamaximum May 23, 2013 2:11 AM (in response to cabaka11)HittestObject must be non-null error
If your 3 objects are only living in one frame of your timeline
the enter_frame functions will not find the other two objects.
alter your function as follows
stage.addEventListener(Event.ENTER_FRAME, touching);
function touching(e:Event){
if(this.currentFrame == 1){
if (theman.hitTestObject(green1) == true) {
green1.alpha = 0;
points = 2;
trace (points);
gotoAndPlay("green2");
}
}
else if (this.currentFrame == 2){
//insert your touching2 functions code
}
else if (this.currentFrame == 3){
//insert your touching3 functions code
}
}
-
2. Re: Hello, I am trying to write a small game i
cabaka11 May 23, 2013 11:40 AM (in response to moccamaximum)Hello,
Thank you very much for your response. However, I could not make it work the way you suggested either. I guess the reason is because my three objects are not in the same frame. The first green ball is located at Frame 1. The second green ball is located at Frame 3 and the third green ball is located at Frame 6.
And they all have frame labels as ("green1"), ("green2"), ("green3") seperately. I assume this is why you are code does not work either.
Would you have any other suggestions for me?
Thank you very much for your time and consideration.
Best,
Cagri Kasap
-
3. Re: Hello, I am trying to write a small game i
Nabren May 23, 2013 12:54 PM (in response to cabaka11)You could use if (this.currentFrameLabel == "green1"), if (this.currentFrameLabel == "green2") or if (this.currentFrameLabel == "green3") for your frame checks in that case.
-
4. Re: Hello, I am trying to write a small game i
moccamaximum May 23, 2013 11:47 PM (in response to Nabren)this.currentFrameLabel should be this.currentLabel, otherwise Nabrens advice is sound


