HitTest On Multiple Mcs?

May 14, 2009

I have a movie clip called frog who moves along the screen, I want him to jump when he hits any other movie clips. I can make him do so with the code below, the problem is that if I write the same function for the other movie clips it doesnt work, it still works on the first one but none others. I have tried attaching an onCilpEvent on both the frog and on all the other movie cilps so no avail.
 
function hitBaby(){
if(_root.babyWord.hitTest(_root.frog)){
_root.frog.gotoAndPlay("frogB");}else{  _root.frog.gotoAndPlay("frogA");}

[code]....

View 3 Replies


Similar Posts:


Actionscript :: Hittest On Multiple MCs?

Jul 7, 2011

I am running a hittest on an array of thousands of MCs a little a part, due to the nature of this sometimes two can be hit at once.How would I narrow it down so that the one which is hit the most is the one returned value?

View 1 Replies

ActionScript 2.0 :: HitTest On Multiple Instances Of Same MC?

Jul 18, 2010

How to apply the hitTest to multiple objects for a side scroller game. Right now, I have the MC:hero hitTest against the MC:ground and MC: platform. Problem is, if I want multiple platforms (IE: copying and pasting the orginal MC: platform) he will only hitTest on the 1st instance (platform1). I've since read up on it and learned that Flash will only hitTest on that first instance. But is there a way to make that MC: platform universally hitTest my MC:man? As it is right now, I have to code into the MC:man instance each and every platform instance. It's not a big deal, but after about 5 platforms, the codes seems unnecessarily long. I'm new to AS so I know there's got to be an easier way. Maybe arrays or something?

View 12 Replies

ActionScript 1/2 :: HitTest On Multiple Objects?

Jun 29, 2009

Im trying to make a small game. Could someone take a look at the CS4 and CS3 fla files attached and tell me how to make the game reset when the red circle touches the block boxes.

View 7 Replies

ActionScript 2.0 :: HitTest On Multiple Objects?

Jul 1, 2009

I have many black boxes fallling down and i want the game to reset when the black boxes touch my red circle. I used this code for my boxes:

ActionScript Code:
this.createEmptyMovieClip("canvas_mc",10);
myInterval = setInterval(addbox1,500);
function addbox1() {

[Code].....

View 9 Replies

ActionScript 2.0 :: HitTest With Multiple Clips?

Feb 2, 2004

say I have 3 movie clips I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work

[AS]
onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three;
}
onClipEvent (enterFrame) {

[Code]...

It's just a quick example of what im trying to do. one, two, and three are movieclips. Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?

View 5 Replies

ActionScript 2.0 :: [MX] HitTest With Multiple Clips?

Feb 2, 2004

I have 3 movie clips... I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work

[AS]
onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three; [CODE]....

one, two, and three are movieclips.Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?

View 5 Replies

ActionScript 2.0 :: Flash8 - Use One HitTest For Multiple Objects?

Jul 28, 2010

I'll try to make my question pretty short and simple.

[Code]...

So what I'm trying to do is make the character stop when it runs into something. I can do that, but it will only work for one "block" movieclip I put on the stage. What can I do to make this work for multiple "blocks"?

View 2 Replies

ActionScript 2.0 :: Target Multiple Instances With One HitTest?

Jun 7, 2010

[Code]..

I want to use the above code (obviously with more meat inside of it) on multiple instances of the same symbol, but when I name the instances "wall" only one of them actually performs the hitTest. Is there a way to pull this off without having to perform a hitTest on every instance?

View 0 Replies

ActionScript 2.0 :: MX: Switch Display Multiple MCs Using A Hittest?

Aug 17, 2005

prepare the area with instances of the 3-people-MC for the "maximum amount of people" case (covering the whole area).have a shape in their midst, filled with a transparent fill (or have it be invisible, if that would still work with a hittest).resize the shape mentioned in "2." according to how many people I really want displayed (change width and height).have a function nested in each 3-people-MC that checks whether or not that MC is hit by the shape from "2.".make the 3-people-MC visible or invisible according to "4.".Is that doable? how would you write that? Before, I was just working with a mask- but I am having trouble checking if the mask hits the people MCs or not

View 6 Replies

ActionScript 3.0 :: HitTest For Multiple Movie Clip At The Same Time?

Dec 5, 2009

I have a movie it is a triangle.I duplicate it and I want to hitTest on the first triangle movie clip and I added 3 different line movie clips on the 3 side of triangle.I tried to write a code something like that.
 
if(firstTriangle_mc.hitTestObject(line1_mc,line2_mc,line_3mc){
trace("Ok");
}

but I've got error.I think it is not allowed hitTestObject for multiple Movie Clips.So is there anyone have an opinion about it?What should I do?

View 5 Replies

ActionScript 1/2 :: Hittest Multiple SAME Movie Clip Entities?

Feb 15, 2010

By using the attachMovie function, I create multiple entities of the same movieClip. Is it possible to detect collisions from the same, but multiple movie clips (And, with different Linkage Identifiers with each entity of the same movieClip.

View 3 Replies

ActionScript 3.0 :: Fail Hittest Collision Using Multiple Arraylist Objects

Jan 4, 2011

I'm actually working on a multiple collision detection in actionscript 3.0, using pixel collision for a game for my assignment, where an enemy patrols around and searching for the hero. So, i draw a line between the enemy and the hero, to check whether there's some collision happened between those two. if the line colllides with an obstacle such as wall, door, etc. enemy will not be able to see the hero. When i tried a single line collision with a wall (one object only) it works perfectly.

But here's the problem. For the multiple objects collision (several walls and doors included), i added those objects in an arraylist, When i used for loop to check the collision between the line and those objects in the arraylist, none seems to react , except the first object in the arraylist or index 0.

Is there any simpler way to do the multiple collision detection?

View 2 Replies

ActionScript 2.0 :: Hittest With Multiple Array - Without The Rest Of The Array Numbers Being Reset

Mar 20, 2009

The Setup: For each movieclip the hittests a set of "target" movieclips an array is given a value. If mcIcon1 is dropped onto mcTarget1 the first number in the vacant array is given the value of one. The Issue: If I remove mcIcon1, for example, from the mcTarget1 movieclip I can't find a way of just removing the 1 from that array without the rest of the array numbers being reset.

[Code]...

View 9 Replies

ActionScript 2.0 :: Create An "hitTest" Script Inside A Movieclip That Is Actually Part Of That HitTest Code?

Jan 15, 2009

i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).

View 1 Replies

ActionScript 3.0 :: Do Something After Hittest " Remove Hittest After First Collsion"?

Feb 8, 2010

i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:

import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 2.0 :: Set Depth On A Hittest?

Feb 25, 2009

i have this drag and drop thing basically when i drop the item on top of its slot i want it to do a hittest to set the depth to a number assigned to it. so lets say I drag an item called Item to a spot called slot i want it to do like item on hit test to slot set depth(2) lets say.

View 1 Replies

ActionScript 3.0 :: Hittest Is Not Working

Apr 7, 2010

i'm trying to build this simple game for school: you've got a catapult which launches a "bullet" and you will have to aim it to hit a certain point. Now the whole catapult part and shooting the "bullet" works, but now it has to respond when it hits something, and that's where i'm stuck.

[Code]...

View 1 Replies

ActionScript 2.0 :: HitTest Is Not Working

Aug 12, 2010

I'm trying to make a hitTest between to movie clips (Let's call them J and T)[code]But nothing happens when the two movie clips collide.

View 5 Replies

ActionScript 3.0 :: HitTest : Can't Get It To Work

Mar 17, 2011

I am trying to create a game. My game is birds eye view game and I am trying to get it so my character (instance name hero_mc )can't pass through the buildings(instance name block_mc). I have been looking at tutorials on the web and most of them cover it so that a text appears if you hit the object whereas I want it so my character can't pass through or well is "push back", the one tutorial I found doesn't want to work for me, but it's not giving me any errors so I really don't know what is wrong with it.

Actionscript Code:
hero_mc.addEventListener(Event.ENTER_FRAME, enter_frame); function enter_frame(event:Event):void{if (hero_mc.hitTestObject(block_mc)) { trace("hero _mc is next to block_mc") } else { hero_mc.y += 10  hero_mc.x += 10  } }

My character still passes through the block objects.

View 1 Replies

ActionScript 2.0 :: CS3 To HitTest Within An Array?

Jul 22, 2011

I have this thing where orbs are supposed to stick together, so I put them all in an arrayand told them to stick together when they encounter another member of that array.However, they only stick in groups of up to four, and then the orbs begin to overlap and such.

View 2 Replies

Using Hittest And Attaching Sounds?

May 12, 2009

I am working on a game that involves a play head (called playHead) moving along the screen and when it encounters various movie clips it triggers a sound to be played. It is all going well except that the sound seems to want to play more than once, so there is a staggered wierd sound. Is is possible to make the sound only play once and also it needs to play until the the sound has finished. (the sounds are all very short).Here is the code:
 
onClipEvent(enterFrame){    if (this.hitTest(_root.playHead)){            _root.sound15.stop();    _root.sound15.attachSound("over");    _root.sound15.start();            }       }

View 5 Replies

HitTest Was Playing The Sound Over And Over?

May 20, 2009

I have a playhead that moves across the screen and when it hitTests a movie clip it plays a sound. all is working fine except that it will only work the first time it is played. The playhead is controlled by a button. I am working in Actionscrpt2. Here is the code on the movieclip:

onClipEvent(enterFrame)[code]....

In the begining I was having trouble because the hitTest was playing the sound over and over but the above code sorted that out. I think that the new problem was created by fixing the old one.

View 7 Replies

ActionScript 1/2 :: HitTest And Draggable MCs?

Aug 16, 2009

These codes are in the draggable MC: fish1_drag this is my code:
 
onClipEvent (enterFrame) {    this.onPress = function() {        startDrag(this);    };
_root.UI1_mc.UI1_mc2.inv_mc.ISpace1.onEnterFrame = function() {        if (this.hitTest(fish1_drag)) {            stopDrag();        } else {        }    };}
 
I keep jumbling it up so that one thing works but the other doesnt. But basicly I need it so that when I drag fish1_drag (instance name) over ISpace1 (which is within many MCs : _root.UI1_mc.UI1_mc2.inv_mc.ISpace1 but opens up so you can drag it over it) for it the drop on the ISpace1.
 
I have another MC in the library and il get that the attach to the ISpace1 but what im finding difficult is just being able to drag the fish1_drag over the ISpace1 and releasing.
 
Here is some other reandom code that I have in a comment on my AC panel:
 
/*
this.onRelease = function() {                stopDrag();                _root.UI1_mc.UI1_mc2.inv_mc.ISpace1.attachMovie("fish1_mc","attached1 ",this.getNextHighestDepth());                _root.invCount += 1;                updateAfterEvent();  // I probly dont need this updateAfterEvent. but its there anyway.            };
*/

View 3 Replies

ActionScript 3.0 :: Hittest Is Not Working?

Apr 7, 2010

i'm trying to build this simple game for school:you've got a catapult which launches a "bullet" and you will have to aim it to hit a certain point.Now the whole catapult part and shooting the "bullet" works, but now it has to respond when it hits something, and that's where i'm stuck.
 
I've included:
 
if (stok.kogel.hitTestObject(this.muur)) {           trace("ball hit")            }
 
but I just can't seem to get an trace back.(PS: here's the file as refference (all AS is in the catapult))

View 7 Replies

ActionScript 1/2 :: Perform HitTest Between Mc Within An Mc?

Aug 17, 2010

how to perform hitTest between mc within an mc??i tried it in the same timeline and it works, but those two movieclips (BLUE COLOR) is inside different MC'sis there a way to perform a hitTest between them??

View 3 Replies

ActionScript 1/2 :: GotoAndplay On HitTest?

Sep 8, 2010

I'm trying to make it so that when a movieclip (box) touches another movieclip (exit), it goes to frame 2.I've made it so that (box) moves with the arrow keys and doesn't go pat the barriers (boulders) using this:

x.onEnterFrame = function()
if (Key.isDown(Key.RIGHT)) {box._x += 5;}
if (Key.isDown(Key.LEFT)) {box._x -= 5;}

[code]....

View 2 Replies

ActionScript 1/2 :: HitTest The Same Movieclip?

Sep 4, 2011

_root["zombie"+i].onEnterFrame = function() {
if(this.hitTest(this)){
trace("hit!");
}
}
 
This does not work, it traces hit! even if none of the movieclips are touching. dont know how else I can do this.

View 9 Replies

Flash :: AS2 To AS3 HitTest Migration

Nov 20, 2009

I am stuck in as3 hit test problem. this is the code i wrote in as2. migrate this in to as3

[Code]....

View 2 Replies

Flash :: AS3: HitTest Any Object

Apr 6, 2011

I am working on an application where an image serves as cursor. Now i would like to know at any time over which object the cursor is hovering. Sort of like a HitTestObject(*) where i can then see what object the * represents. how i could accomplish this? (and using the mouse is not an option)

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved