ActionScript 3.0 :: HitTestObject Collision Coordinates?

Aug 28, 2011

my scene a group of cups moving randomly on the stage, with a hitTestObject the cups change their direction when one cup crash with another one, then i need to get the collision point coordinates to add some effect, o you know how can i get that point?

View 4 Replies

Similar Posts:

ActionScript 3.0 :: Collision Detection - Use HitTestObject?

Oct 28, 2010

HitTestObject seems to check collision of bounddaries of shapes, it seems to consider everything rectangular. Also if one object jumps two pixel and other five pixels on EnterFrame it seems like there won't be any hit detection. Seriously guys what else method do you use, if you use hitTestObject how do you use?

View 1 Replies

ActionScript 3.0 :: Collision Detection HitTestObject()?

Apr 26, 2011

Here is part of my code:

protected function button_clickHandler(event:MouseEvent):void


View 0 Replies

ActionScript 3.0 :: Collision Detection - HitTestObject Broken?

Feb 18, 2008

I'm making a basic platformer to familiarize myself with AS3. I'm currently having an issue with the HitTestObject and HitTestPoint methods. Currently my game consists of a character who can run and jump, and a box which should prevent him from falling. I have two questions (the complete code is attached and is only
briefly referenced in the questions):

1) Why is my HitTestObject broken? The issue I'm having is that when I perform box.HitTestObject(character), the screen shakes in most of the character poses (i.e. facing left or right) but not when the character is crouching. I suspect this is because the bounding box in the different frames of my character movieclip are not the same. Is this the case, and how can I make certain my bounding boxes are exactly the same across all frames?


View 1 Replies

Actionscript 3 :: Flex Collision Testing With HitTestObject

Aug 14, 2009

I'm trying to test clipping on two canvases. Both canvases are 100px wide. They're 20px apart. I've placed a label inside one and made it 200px wide. Scroll bars will show up on the canvas. When I don't have the label inside and use hitTestObject it returns false. When I place the label inside it returns true. Is there any way to alter the canvas with the label inside so that it doesn't expand to the width of the label?


View 1 Replies

Flash :: AS3 - HitTestObject Collision Not Registering Correctly

Aug 7, 2011

I had a problem with my hitTestObject collision detection a couple of days ago which has since been fixed (How can I solve my hitTestObject Collision Null Object Ref Error) with the help of you folks. My problem now is as such: When my "enemy.hit" comes into contact with "player.hit" it registers as a hit - this is good. When my "building.collide" comes into contact with "player.hit" it registers as a hit - this is good.

However, when my "building.collide" comes into contact with my "enemy.hit" it does not register, but sometimes it does register even though the only enemy on-screen is many pixels away from it - as if either the building or enemy "hitBox" is somewhere other than directly on the graphic(MovieClip in this case).


View 3 Replies

ActionScript 3.0 :: Use Collision Detection (hitTestObject) With IK Armature?

Dec 29, 2010

What I am trying to do here is to simply import an armature, then I want to add an object to the stage which, when collide with the armature, will do something (dissapear etc). is that possible to do with the armature?

View 1 Replies

ActionScript 3.0 :: Collision Detection Is Not Working - HitTestObject Function

May 17, 2010

Collision detection is not working for me. My objects are planes in 3D space.

1) I have tried hitTestObject function.

2) I have also read [URL] and tried it. With no success in both cases.

View 6 Replies

ActionScript 3.0 :: Flash MovieClip - HitTestObject For The Collision Detection

Apr 28, 2011

I have a bullet object and a boulder object (both movieclips originating from JPEGs) in my AS3 game. The trouble I'm having is with hitTestObject for the collision detection, as it's taking in to account the transparent areas and basing the collision on the bounding boxes surrounding the movieclips. This is a problem because the collisions are not accurate and if the bullet (long and thing line shaped) is at an angle...the bounding box is quite large around it...and it's "colliding" with the boulder even though it's visibly many pixels away. Is there a way to detect MovieClip collisions that ignore transparent areas?

View 2 Replies

Actionscript 3 :: Convert Global Coordinates To Local Coordinates Of A UIComplenent In Flex Project?

Dec 19, 2011

I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point

uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue

var lp:Point = new Point(e.localX,e.localY);

I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2

var lp2:Point = new Point(e.localX,e.localY);

now surprisingly it was giving correct values as expected and I went back and changed the code as

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);

now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.

View 1 Replies

ActionScript 2.0 :: Converts 3d Coordinates To 2d Coordinates - Difference Between MoveTo And LineTo?

May 21, 2007

I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:

transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....

I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:

red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);

View 4 Replies

Collision Detection Incorrectly Detecting Collision?

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 =


View 1 Replies

ActionScript 3.0 :: Converting Papervision Coordinates Into Cartesian 2D Coordinates?

May 3, 2010

Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.

View 2 Replies

Professional :: How To Use HitTestObject()

Apr 8, 2010

In my program,  the movieclips are randomly added on the stage,  If I want to check whether two movieclips from different classes is colllided.As far as all the moveclips are of the different classes which are randomly added on the stage in my program,for the use of hitTestObject(), I find that I need to have two movieclips identified so that the command will be:

maybe I may ask, before I add a mc on the stage "addChild(mc)",I will call a function to do the hitTestObject command "mc.addEventListener(Event.ENTER_FRAME, hitTest)"so that I can call to be mc1, is that true or not?

View 14 Replies

Actionscript 3 :: HitTestObject With Itself?

Jan 5, 2012

Im've created a timer that starts every 1 second. This is the code what's happening every 1 second.

var Random_Value_X:Number = Math.ceil(Math.random() * 1500);
var Random_Value_Y:Number = Math.ceil(Math.random() * 2000);
var enemy:MovieClip = new AI(stage);
enemy.x = Random_Value_X;
enemy.y = Random_Value_Y;

Ok. Then I got the class called AI where I've made it so the AI follows my player. The thing is, I need to make a hitTest that testes if an AI hitting another AI? Is there a way I can give every new AI a ID? Like the first gets called "AI1" and second AI2" and then I can make a code that says like If(AT1.hitTestObject(AT2 || AT3))

View 1 Replies

ActionScript 3.0 :: CS4: HitTestObject Allows MC To Pass Through?

Sep 12, 2009

I am trying to develop a basic game engine for a slime soccer style game where a player can move around and jump. I am still fairly new at AS3 but managed to put together this working bit of code that the game currently runs on:

var runSpeed:Number = 10;
var blueGoals:Number = 0;
var redGoals:Number = 0;


View 4 Replies

ActionScript 3.0 :: HitTestObject On Children To Themselves?

Jan 9, 2012

I have children being added to the stage, and they all have the same name:


and then inside them I have them looking for a hit test of any movieclip with the name art_crab, but I keep getting a null response...


how i can make sure that they collide and i dont get this response?

View 7 Replies

ActionScript 3.0 :: How To HitTestObject Using Arrays

Nov 13, 2009

I have a project with four circles moving randomly on stage (ball_mc1..ball_mc4). There are four walls making a box (wall1..wall4).I've created arrays for both myCircles and walls.When myCircles hit walls, I would like to change the direction of myCircles depending on which wall they hit.

stop();// walls or limits and their arrayvar walls:Array = new Array (wall1, wall2, wall3, wall4);for (var j:Number=0; j<walls.length; j++);
// circles in arrayvar myCircles:Array = new Array (ball_mc1, ball_mc2, ball_mc3,


View 11 Replies

Professional :: Using 'for Loops' With HitTestObject() ?

Feb 7, 2011

I have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....

However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....

TypeError: Error #1010: A term is undefined and has no Function/<anonymous>()

View 3 Replies

ActionScript 3.0 :: SharedObject And HitTestObject?

May 12, 2011

Im trying to get Flash to rember if the logo_mc has been hitTested with the holder, and if it has when the movie is played again it appears in the box and not the original spot

var mySO:SharedObject = SharedObject.getLocal("ObjectPlace");
var logo_mc:Sticker = new Sticker  ;


View 1 Replies

ActionScript 3.0 :: Get The X,y Position Of HitTestObject()?

Nov 30, 2011

How do I get the x,y position of  hitTestObject? Since I want to obtain the x,y position where the hit test occurs and add a movieclip on that specific point....

View 2 Replies

Flash :: HitTestObject On Child Of A MC?

Jan 16, 2011

I have a MC called 'playerP" and inside of it with 7 different MC. I can't seems to hit test on the children MC, it always show [object position_2]

private function cMove(e:MouseEvent):void
trace(MovieClip(playerP.RR), playerP.PT)


View 1 Replies

Actionscript 3 :: HitTestObject With For Loop?

Feb 8, 2012

I am building a pacman style game, and I am looking to shorten my code.The stage contains 92 instances with instance names of food1, food2, etc.When the player(pacman) hits one of the instances Im wanting to call a funcion.I started writing it out like this... it works but I don't want to duplicate this 92 times!

if( player.hitTestObject(food1) ) {
if( player.hitTestObject(food2) ) {

Now I'm trying something along these lines, but with no success yet.

function collectFood() {
var i:Number;
var pGroup:String


View 1 Replies

Actionscript 3 :: Go To Next Frame With HitTestObject?

Mar 14, 2012

I would like to make a button that allows you to go to the next frame. I would like to do this with hitTestObject. When the charecter walks over the button, you should go to the next frame.

View 1 Replies

ActionScript 3.0 :: Add Sound To HitTestObject?

Sep 30, 2010

I'm hoping someone can help me. I'm trying to add sound to the hitTestObject script below so that a short sound plays everytime "bolt" hits the ralphie_mc.


View 0 Replies

ActionScript 3.0 :: HitTestObject Firing More Than Once

Dec 15, 2011

I'm working on a scene where the user can drag sugar, honey and syrup flavour to a cup of coffee and each time they collide, the coffee's happiness is increased by 1. I added a TweenLite so that sending any of the objects to their original positions is much more fluid. The problem is that the hitTestObject is now firing more than once (which makes sense and now happiness is increasing at more than one increment at a time) but how can I make it so happiness is increased just once?

public function hitsDecaf(e:Event):void{
if (myCounter.myHoney.hitTestObject(myCounter.decafSweetened)){
ifStartTimer = true;
[Code] .....

View 4 Replies

IDE :: Use HitTestObject On All Instances Of A Movieclip

Sep 25, 2009

I'm trying to make a simple maze game. I have movement working, and now I'm trying to implement collision. Here's what I have:

An 8x8 grid, with walls of length 1 to break the grid up into a maze. the walls are instances of a movieclip I've named "mc_wall" a guitar-pick-shaped chip I'll control the movement of a cross-hair called "arms" that will check if there are walls immediately surrounding my chip by way of collision. "arms" is a movieclip made up of four individual movieclips: "uparm", "leftarm", "rightarm", and "downarm"

I have currently named each instance of "mc_wall" to be "wall" this is the code I have now (using only right as an example):

function moveRobot(event:KeyboardEvent):void
doslide = true;
if (event.keyCode == Keyboard.RIGHT)


this will work, causing the chip to remain in place if the rightarm detects "wall", and move if the rightarm does not detect "wall". My problem is that, although I have named every instance of "mc_wall" to be "wall", the only "wall" flash will recognize is the last one.

Is there a way to adjust this code to look at all 70-or-so instances of "mc_wall" instead of only the last one?

View 1 Replies

ActionScript 3.0 :: HitTestObject In A For Statement?

May 16, 2011

Ok I am building a DnD, I have a hitTest setup, and I know when it hits it. But I can't get out of the for statement if I drop it on the second object. It says it hit it, and then anims back to org. place.

public function onStopDrag(evt:MouseEvent):void {


View 5 Replies

ActionScript 3.0 :: HitTestObject From Any Direction?

May 26, 2011

Press the picture to get it larger. That's what i really need for my project. I can't get it to work.please explain it for me to, im learning flash so I can need that to understand sometimes

View 1 Replies

ActionScript 3.0 :: How To HitTestObject In Class

Sep 4, 2011

I dont think that will work. I need to have it as individual blocks.I did a quick demo file to show what I need. You will se in the file that the map is randomized and I need it to be like that to! READ THIS: I want the green cube to fall down (gravity) and than "land" on the gray cubes. This is a small demo, of my full version flash file, so i need it to be blocks.

View 4 Replies

Copyrights 2005-15, All rights reserved