ActionScript 2.0 :: Detect A Collision Between An Empty Mc?
Mar 28, 2005
what i am trying to do is to detect a collision between an empty mc and an mc allready in stage.the empty mc is a line, which I draw with the mouse. when this line hits the other mc I want the colission to be detected. so far it doesnt work properly.the colision is being detected even if the line that i draw, doesnt hit the other mc. does it have to do with the properties of the empty mc, or the hittest method has to be changed?Here is the code:
_root.mc.onEnterFrame=function(){
if(_root.mc.hitTest(_root.line)){
thingstohappen;}
View 1 Replies
Similar Posts:
Nov 12, 2009
I want to detect when a circle collides into a random object. I know this is pretty basic to do with a mouse colliding into a random object but I want to modify this for a circle. I have seen some examples which use circles but they are drawn in script, is it possible to do this with a mc from the library.
View 2 Replies
Feb 10, 2010
im creating a circle dynamically with each click on stage, with the drawCircle function, now, that circle is a shape, not a movieClip, im arranging this circles inside of an array, and i want to check if they collide, so that second circle dont appear if its occupying the same space as the last one, or at least trace if they are colliding so i can do something about it....
i've made tests with movieClips and no problem, the mc1.hitTestObject(mc) works great but not so great with raw shapes, it just ignores collisions
View 4 Replies
Feb 24, 2005
Is there a way to detect what movie clip is in a certain location? For instance, if I enter some random coords, like x=15, y=0, is there a way it will return the name of the movieclip thats occupies that location?
View 1 Replies
Jun 25, 2008
Because I want to detect collision between a point and an MC contained within another MC.
View 1 Replies
Jan 4, 2011
Take a look at this scenario, I have two characters, one shoots two bullets on the direction of the other character, the bullets are fired instantly and travel at infinity speed, how to detect a collision? Here's an image to illustrate the problem: The red bullet would clearly miss, but the green bullet would hit, how to perform this kind of collision test?
View 1 Replies
May 17, 2011
My collision detection is solid when I put 2 images against each other but when I put 1 image against another image's child I can't get a collision. Whats the deal? Do I have to add the child independently of its parent?
View 3 Replies
Apr 9, 2011
If you have a group of movie clips stored in an array and the movie cliops are placed on the stage randomly, and use your arrow keys to move a box on top of one of the movie clips - how can you "tell" Flash which movie clip you clicked on?
Right now I've got a for loop going which loops through the array that has stored the movie clip instances, presumably the hitTestObject would eventually get a hit...But this doesn't work, especially inside an event handler where when I press the right arrow on my keyboard.
[Code]...
View 2 Replies
Nov 5, 2008
i have two movie clips mcTrap and mcCharacter.how can i detect collision (character is fully inside) over the trap door?
View 1 Replies
Feb 23, 2010
So in my game, every 'enemy' movieclip creates a textfield that represents the name of the enemy. The problem is, I want my collision detect engine to detect a collision with the enemy itself, not the textfield. This is the code that I have currently have on my collision class for detecting a collision with the enemy:
for(var i = 0;i < _enemies.length; i++)
{
if(CollisionEngine.isColliding(_laser, _enemies[i]._enemyNameTextField, _animation))
[code]......
View 2 Replies
Dec 12, 2002
Does anyone know how to use hitTest with two movieclips so that it would detectthe collision of the visible part of the MC, not the **** bounding box???
View 2 Replies
Oct 13, 2005
Right now I'm working on an advanced hitTesting engine, and What I'm trying to do here is create an engine that will detect collision with one object instead of two. That basically means that if any other objects touch this movie clip, the hitTest will return True. Right now the .fla containing the engine has nothing but a circle that can be moved using arrow keys and 8 squares that disappear when touched by the circle. Obviously, I could do something like:
if (circle.hitTest(square1)) {
do so and so
} else if (circle.hitTest(square2)) {
do this and that
} etc...
But that would be too long, since the engine has to be able to contain 100 squares without too much change in the code.
View 3 Replies
Apr 12, 2011
i am listening contact between dynamic bodies. But cannot listen contact between dynamic and static bodies .
I can handle collision detection on my b2contactListener class with this metod.
public override function BeginContact(contact:b2Contact):void {
// getting the fixtures that collided
var fixtureA:b2Fixture=contact.GetFixtureA();
[Code].....
View 1 Replies
Jun 3, 2011
how could i detect empty input in a textfield?[code]not working..
View 4 Replies
Jan 10, 2011
I got it working for using the e.target of the mouse but now I need to filter through the array on enter frame and detect whether a collision is detected.[code]
View 4 Replies
Aug 20, 2009
if (txt_email.text == "") {
trace("1: Please fill in your email");
}
if (txt_email.text != ""){
trace("2: Email filled successfully");
}
No matter you leave the textfield empty or with words filled up, it still display the second result.
View 6 Replies
Oct 16, 2009
In my file (AS2), I have a small square at the middle of the page. Diagonally to the right, I have a vertical wall which is a rectangle. Pasted inside my small square, I have the code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (this.hitTest(Wall._x, Wall._y, false)) _x =
[code]......
View 1 Replies
Mar 3, 2009
I have a list of 99 item (something like a phone book) and I will like to sort them in different method. Part of the 99 item might be empty, so the requirement is to move the empty field behind the sorted data in every sorting behavior, here the code we have so far:
[Code]...
View 1 Replies
Feb 18, 2012
Is there a static property in Action similar to that in the String object in .net to check if a string is empty, that is String.Empty.
View 2 Replies
Sep 14, 2009
I worked on a new Flash project, but I cant seem to find a good solution for how I want my objects to collide. In my project I have: a Ball(moving object) and a Floor(not moving).
The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
[Code]...
Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it? Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?
View 1 Replies
Sep 14, 2009
In my project I have: a Ball(moving object) and a Floor(not moving).The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
[code]....
First: the -23 in the code is what I don't like. Second: every single object that deals with collisions would need to be put into the if statement.Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it?Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?
View 2 Replies
Jan 7, 2010
What kind of code would one need to check for collisions between two symbols? I am hoping to become a game designer so this is important for future references.
View 8 Replies
Jun 21, 2010
Im currently working on a demo flash game built on AS 2.0. im a very beginner to this flash and AS and im stuck up with a very silly concept though im not able to overcome it. the problem i have is with collision detection ie hit test and im really struggling with it.
[Code]....
View 1 Replies
Jan 31, 2010
I am trying to use boxes for hit collision. I want to be precise with the collision so I was thinking about making multiple small boxes and checking for collision that way. This maybe a stupid idea or a smart one. If I do this way will that affect the performance of the game even though the boxes are invisible and wont be drawn on the stage.
map out the object starting from its center outward. Like right, left, top and bottom. I am creating a flying shooter so the plane has a long wing span. I could also map out the wing span and tail and so on.
View 2 Replies
Sep 14, 2009
In my project I have: a Ball(moving object) and a Floor(not moving).The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
Code:
var gy:Number = 0;
var gravity:Number = .2
function ballMovement(event:Event):void{
[code]....
First: the -23 in the code is what I don't like.
Second: every single object that deals with collisions would need to be put into the if statement.Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it?Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?
View 1 Replies
Feb 2, 2010
suppose I have a set of movieclips on stage. Each movieclips has its own name. I can drag one of these and check when my dragged movieclip collide with the other ones. Is there a way to determine the name of the movieclip that was hit by the dragged one without having to use a for-loop statement and/or array?
View 2 Replies
Oct 16, 2010
Im using CDK, and I want to exclude color black.im using this: __collisionList.excludeColor(0x00000000);
View 5 Replies
Jun 7, 2007
I have two particles (mc's) that are linked together to a line. Both particles use xspeed and yspeed when they are moving.
Then to my question.. how will the particles xspeed/yspeed change when the line collide into another movieclip? I know how I can check the collision, but I don't know how I'm going to change the speeds.
I have to use (in the very collision moment);
particle_1's xspeed/yspeed
particle_2's xspeed/yspeed
the lines rotation the direction the line came from the length of the line where on the line it collides
View 4 Replies
May 3, 2009
Its been many years since I've used flash and I was just wondering what the easiest way to do collision detection was now. I know that there was some hit test bounding box stuff present earlier but I don't know the capabilities of flash cs4 and the advances that have been made. Google searches have yielded things like complex pixel-perfect collision detection but not a lot seems to have been written about CS4 yet.
View 3 Replies
Feb 10, 2010
I am trying to create collision detection between mcs without having to write the code 10 times.
I thought this would work but it gives me this error:
TypeError: Error #1034: Type Coercion failed: cannot convert "crisisAnimation" to flash.display.MovieClip.
at ImagineServicesText2_fla::MainTimeline/hitTester()
Code:
var target_mc:Array = new Array();
var numTextBoxes:Number;
target_mc = ["crisisAnimation","eventTextAnimation","mediaRelationsAnimation", "mediaAnimation", "graphicAnimation", "webAnimation", "advertisingAnimation"];
[code]....
View 4 Replies