Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash


Advertisements:










ActionScript 3.0 :: Collision Detection HitTestObject()?


Here is part of my code:

Code:
protected function button_clickHandler(event:MouseEvent):void
{

[code].....


View 0 Replies (Posted: 04-26-2011, 11:50 AM)

Sponsored Links:

Related Forum Messages For Flash category:
ActionScript 3.0 :: Collision Detection - Use HitTestObject?
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?

Posted: Oct 28, 2010 11:16 PM

View 1 Replies!   View Related
ActionScript 3.0 :: Collision Detection - HitTestObject Broken?
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?

[Code]....

Posted: Feb 18, 2008 2:47 PM

View 1 Replies!   View Related
ActionScript 3.0 :: Use Collision Detection (hitTestObject) With IK Armature?
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?

Posted: December 29th, 2010

View 1 Replies!   View Related
ActionScript 3.0 :: Collision Detection Is Not Working - HitTestObject Function
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.

Posted: May 17, 2010 10:43 AM

View 6 Replies!   View Related
ActionScript 3.0 :: Flash MovieClip - HitTestObject For The Collision Detection
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?

Posted: April 28th, 2011

View 2 Replies!   View Related
Collision Detection Incorrectly Detecting Collision?
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]......

Posted: Oct 16, 2009 7:20 PM

View 1 Replies!   View Related
ActionScript 3.0 :: HitTestObject Collision Coordinates?
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?

Posted: 08-28-2011, 04:42 PM

View 4 Replies!   View Related
Actionscript 3 :: Flex Collision Testing With HitTestObject
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?

[Code]...

Posted: Aug 14 09 at 4:58

View 1 Replies!   View Related
Flash :: AS3 - HitTestObject Collision Not Registering Correctly
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).

[Code]....

Posted: Aug 7 11 at 22:27

View 3 Replies!   View Related
AS 2 :: CS3 Collision Detection Ie Hit Test
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]....

Posted: 06-21-2010, 01:05 PM

View 1 Replies!   View Related
Actionscript 3.0 :: Collision Detection Kit?
Im using CDK, and I want to exclude color black.im using this: __collisionList.excludeColor(0x00000000);

Posted: Sat Oct 16, 2010 8:44 am

View 5 Replies!   View Related
IDE :: Easy Way To Do Collision Detection?
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.

Posted: May 3rd, 2009

View 3 Replies!   View Related
ActionScript 3.0 :: Get Some Collision Detection Working
I am trying to get some collision detection working. What I have is a ball moving around the stage. There is a box in the middle which when the ball hits, I would like it to bounce off the box. I can get the x axis working fine using hitTestObject but when I detect for collisions on the y axis, the two axis conflict. Does anyone have a way of doing this properly?[code]

Posted: 03-19-2009, 08:53 AM

View 4 Replies!   View Related
ActionScript 3.0 :: Best Way To Do Quality Collision Detection?
So I've been googling around for information on detecting collisions in AS3 and I found this page which has what troy claims to be a 'pixel-perfect' collision detection algorithm:[URL]..

[Code]...

Posted: Aug 25, 2008 9:55 PM

View 1 Replies!   View Related
Actionscript 3 :: How To Do Collision Detection For Hollow
I'm making small interactive games in flash to learn AS3,I need to check the collision between the player and the wall which is normally simple using the hitTestObject function.But now I made a wall object totally surrounding the player with corridors and turn, a collision playground so to speak. Now when I use the hitTestObject function to check whether the player is in collision with the wall it tells me it always collides supposedly because the player object is within the bounds of the wall object.So assuming that I'm correct about the error:How can I prevent getting a collision when I'm inside the bounds of the wall object but not touching the actual walls in that object?

Posted: Apr 19 10 at 17:05

View 2 Replies!   View Related
Actionscript 3 :: Collision Detection Is Not Recognized?
I'm trying to make a game like Mario. I've made a character which can jump right now, but I've got some problems with collision detection.

I would like my character to jump on a bar, which is placed higher. My collision detection doesn't work at all I gues..I've made a cirle which has a instance name mcMain and I've made a MovieClip of it. T also made a rectangle which has a instance name balkje, I also made aMovieClip of it.

I hope you can tell me what is wrong about my code and what I've to change to make the collision detection work!

[Code]...

Posted: Feb 22 at 14:28

View 1 Replies!   View Related
ActionScript 3.0 :: Too Many Objects For Collision Detection?
I have Object "A" that moves around and collides with other objects. There are hundreds of other different objects it can collide with. The only way (I found) to test for collision is to loop through every other object. That seems rather inefficient considering I don't even know how many objects exists. Other objects are constantly created and deleted. So this loop would be rather complicated.Is there a way for object A to receive what other object it collided with so that I can then do some code on that other object. Any way to avoid looping? I later need to find out how to detect what objects are near (within x pixels or so) of object A to decide with which one to interact. Maybe that could also be used now to limit the test of collision? Or maybe it gives someone an idea of what to try?

Posted: 09-16-2009, 05:42 PM

View 4 Replies!   View Related
ActionScript 3.0 :: Collision Detection Between Two MovieClips?
I am in the process of building a project in which several MovieClips "swim" around semi-randomly, and another MovieClip that appears and expands over the mouse on click alters the frequency of the turns. Do do so, I simply need to change the value of a single variable on the first MovieClip's timeline when the two collide. I am using hitTestObject, but I keep running into errors. The expanding MovieClip does not have an instance name, because it only appears when the mouse is clicked, and quickly disappears.

I am receiving the error 1067: Implicit coercion of a value of type Class to an unrelated type flash.display.DisplayObject My code causing my first MovieClip to "swim" is on that MC's timeline, while the rest of the code is on the main timeline.

Posted: 06-11-2010, 05:20 PM

View 2 Replies!   View Related
ActionScript 3.0 :: Collision Detection Between Two Childs
I have this problem: I am making a game with flash cs5, and i am coding in as3 i have written some code, that spawns an child (a fireball) from the character position. i made a movieclip symbol on my main scene, that mc is the "parent" for all the enemies that i am adding but now i need to detect the collision between an enemy child and a fireball child, does anybody know how to do that? if asked i can post some parts of my code

Posted: 04-10-2011, 02:55 PM

View 2 Replies!   View Related
Collision Detection And Bounce Physics?
I need help with one of my Flash projects,I'm trying to use gskinners shape based collision detection, but for some reason I cant get it to work, but im pretty new to using classes, so I dont understand the structure too much. Can i get a tutorial on how to use the gskinner class? im using the as2 version.heres the code, bare with me, there's a lot here. in all codes, mc1 is the track outline MC, and mc2 is the car

basicly im making a 2D top down version of WipEout HD Fury, so file structure is something like this (the .fla is called wipeout as3 because i was initialy coding in as3 and never changed the filename).wipeout as3.fla (the flash file containing all the MCs and animations, but only enough coding to import all of the external code files, as well as the VCam and its script)
the code is;

Code: Select all#include RaceControl.as"

the RaceControl.as is used to determine the Car's control scheme, and refers to a physics code called RaceCar.as. i found it on the interwebs, all credit to matt carpenter;

Code: Select all// Race control

// Create key listener[code]........

the Bounce Function is my own work, and is what i want to happen when a collision is detected.now, the movieclip used for the car is my own drawn design, as is the track, and i want to use GSkinner's shape based collision to detect the collisions properly. so far i have the car driving around quite happily but i need it to collide with the walls of the track, rather than drive right through them.

Posted: Wed Jun 15, 2011 8:52 am

View 1 Replies!   View Related
ActionScript 2.0 :: Accurate Collision Detection?
I was wondering how you get the collsion detection to be just what is in the MCs instead of a rectangularness of the movieClip.

Posted: January 4th, 2004

View 8 Replies!   View Related
ActionScript 3.0 :: Collision Detection Woes?
Im trying desperately to learn figure out how to get the collisons working with the blocks.it works on some blocks some times. Ive tried everything I can think of!testBlocksCollisions() is the function that wont work. I have a clip called ball on the stage a clip called bat and block1-9 on the stageu could also explain where I was going wrong that would be immense.this is my code

Code:
package {
import flash.display.MovieClip;

[code]...

Posted: April 20th, 2010

View 10 Replies!   View Related
ActionScript 3.0 :: Best Collision Detection For Games?
I was wondering what classes do you use for good collision detection for games and similar, I have used Corey Oneil's CDK (Collision Detection Kit url... and an as3 port of the Grant Skinner method (url...) but here's the issue, with the cdk the problem is that I'm using flashdevelop and the compiler is kind of strict so I have to rewrite a lot of thing that function in the normal flash compiler, the gskinner port has a problem about some null object reference.I was wondering if any of you could recommend me some classes or tell me how do you handle your collision detection.

Posted: May 14th, 2010

View 3 Replies!   View Related
ActionScript 3.0 :: Collision Detection And AddChild
I have a collision detection working so when I drag an e.target on a button a flv loads externally onto the stage, but the flv keeps adding to the stage repeatidly. Is there a way I can drag the the e.target onto the button that the flv will only add to the stage once, even though the e.target remains colliding with the button?I cant have a MOUSE_UP event listener as I already have an ENTER_FRAME listener within the if statement.

Posted: April 7th, 2011

View 6 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved