lupien
03-03-2008, 02:41 PM
Hi,
I`m builing a game that as a canon that shots balls to try to break walls. I have gravity on that ball and when it hits solid blocks (walls, floors) its bounces. All the block are position in the level with attachMovie. So the breakable blocks are attached inside a movieClip and the unbreakable solid blocks are in a movieClip called "terrain".
The hitTest is setup on the ball i`m shooting.
if (_root.terrain.hitTest((spot_x+_root.cannon._x), (spot_y+_root.cannon._y), true)) {
//Bounce the ball function is called
}
spot_x and spot_y are specific coordinates on the circumference of the ball. So this part work just fine.
Now here is my question and I don`t know if its even possible.
Each block within "terrain" movieClip has its own instance name. I need to find out which block the ball hit. The hitTest his checking if "terrain" is hit so how can I check what movieClip within "terrain" was it?? I`m trying to trace the instance name of the individual blocks but I just can`t figure it out.
Thanks.
I`m builing a game that as a canon that shots balls to try to break walls. I have gravity on that ball and when it hits solid blocks (walls, floors) its bounces. All the block are position in the level with attachMovie. So the breakable blocks are attached inside a movieClip and the unbreakable solid blocks are in a movieClip called "terrain".
The hitTest is setup on the ball i`m shooting.
if (_root.terrain.hitTest((spot_x+_root.cannon._x), (spot_y+_root.cannon._y), true)) {
//Bounce the ball function is called
}
spot_x and spot_y are specific coordinates on the circumference of the ball. So this part work just fine.
Now here is my question and I don`t know if its even possible.
Each block within "terrain" movieClip has its own instance name. I need to find out which block the ball hit. The hitTest his checking if "terrain" is hit so how can I check what movieClip within "terrain" was it?? I`m trying to trace the instance name of the individual blocks but I just can`t figure it out.
Thanks.