ActionScript 3.0 :: Detecting Collisions - See "boom" On Output

Jan 6, 2010

I have 2 movieclips. First its star and second its house. I use keyboard cursor to move my star. When star connect to house i want see "boom" on output. So, all working. But i see boom when star mc border connect to house mc border. But i want to know . Is it possible to make boom just when i connect star body mc, not border.

[Code]....

View 3 Replies


Similar Posts:


Actionscript 3 :: Detecting Collisions In Flash... Or A Better Way Of Doing It?

Jan 4, 2011

I'm trying to create a air-hockey game, in flash using AS3.At the moment, I am using an enter frame function to check the positioning of the 3 objects, 2 paddles and a ball, then it checks to see if they are in contact, if they are it then initiates a detect collision function.However it's checking every time the frame is loaded, and at 25 fps, this is quite a lot and the app lags.

View 3 Replies

ActionScript 3.0 :: Detecting Collisions For Different Parts Of Single Mc

Feb 6, 2010

I have a movie clip 'Player'.I want to divide the mc into two equal halves p1 and p2 for collision detection (p1 and p2 are joined together physically).i.e. if ball collides with p1, i do something and if ball collides with p2, i do something else.But i dont want to create 2 different players p1 and p2 for that.i want to have something like p1 and p2 are a single movie clip 'Player', but still can be accessed separately.

View 6 Replies

ActionScript 3.0 :: Separate Touching Collisions From Overlapping Collisions?

Nov 22, 2010

I'm working on a game (my first) where objects touching is A-Ok, but I want to detect overlapping collisions ahead of time, prevent them, and react. This seems like a pretty basic and common thing, such as a character walking along a platform (even though by touching it it's 'colliding'), but of all the many many collision detection tutorials I've looked at, none of them have covered this case--they all assume that objects touching should be indistinguishable from overlapping. I've been using a workaround of a slightly smaller hitbox to use for collisions, but it has issues of it's own that make it not so good. So basically I'm looking to redo my CD from scratch.

So, like I said, I'd like to know how to differentiate between 'touching' collisions and overlapping collisions, but even a way to keep touching collisions from triggering entirely would work.

View 9 Replies

ActionScript 2.0 :: Unable To Detecting Var Output "NaN"?

Jul 8, 2004

I need to be able to detect if the input a user types into an Input text field is not a number (NaN). I thought this would be a breeze, but I am having trouble. First I created a function that sets a new variable equal to the input value multiplied by 1.Code:valuetest = value*1;For testing purposes I placed a temp text box on the stage (var: valuetest). Sure enough, when the function is called and if value contains anything but numbers, valuetest becomes NaN. Then later on the timeline I check what valuetest is.

Code:
if (valuetest == "NaN") {
gotoAndPlay("error"); }

[code].....

View 3 Replies

ActionScript 2.0 :: Detecting Var Output "NaN"?

Jul 8, 2004

I need to be able to detect if the input a user types into an Input text field is not a number (NaN). I thought this would be a breeze, but I am having trouble. First I created a function that sets a new variable equal to the input value multiplied by 1.

Code:
valuetest = value*1;

For testing purposes I placed a temp text box on the stage (var: valuetest). Sure enough, when the function is called and if value contains anything but numbers, valuetest becomes NaN. Then later on the timeline I check what valuetest is.

Code:
if (valuetest == "NaN") {
gotoAndPlay("error"); }

Does not do what it supposed to. I tried doing this several ways, including putting all the code into the function, but I can not get it to "see" the NaN as a variable. I replaced the "NaN" in the if statement with a number and it works when I input that number... so I suspect that the code is correct and the problem has to be something to do with how Flash deals with a NaN output.

View 3 Replies

ActionScript 3.0 :: Trace Doesn't Output Anything In The Output Window Anymore?

Nov 20, 2009

I'm quite new to AS3 (coming from php/c#) and like it very much. My problem: trace doesn't output anything in the Output window anymore?!

View 2 Replies

ActionScript 3.0 :: Trace Doesn't Output Anything In Output Window Anymore

Nov 20, 2009

I'm quite new to AS3 (coming from php/c#) and like it very much.My problem: trace doesn't output anything in the Output window anymore?!

View 3 Replies

Cant Get Collisions To Work

Jan 23, 2009

I am making a game and I cant get my collisions to work. I will give a link to the files because I use external .as files.

View 1 Replies

ActionScript 2.0 :: Link Input Text To A Variable And Output That Text To The Output Window Using Trace

Jul 22, 2005

I'm teaching myself ActionScript and the book I'm reading just got into input text capabilities. The book shows me how to link input text to a variable and output that text to the output window using trace. My question is: how can I display the text that the user input onto the actual movie. For example... if I wanted the visitor to type their name into the input text box and click Submit and then a phrase shows up with their name such as "Hold on Name, my site will be done soon." How do I reference that variable and have it actually display in my movie?

View 5 Replies

ActionScript 2.0 :: Any Way To Check Collisions By Arrays?

Apr 16, 2010

I am trying to apply code to all instances of the enemy that appear randomly but I've run into problems. Firstly the enemies appear when you press space and the collision doesn't seem to work. I kind of thought you have to push the enemies into an array and hitTest that array right?

Actionscript Code:
stop();
var ship_speed:Number = 10;var lazer_speed:Number = 20;
var enemy_speed:Number = 8;var lazertimer:Number = 0;
var basicenemy:Number = 0;var enemytime:Number = 0; var enID:Number = 0;
var enemies:Array =[]onEnterFrame = function() {
[Code] .....

View 8 Replies

ActionScript 2.0 :: Flash Car Collisions / Hit Test

Sep 5, 2010

I've been using flash for a long time. I know some stuff, but not enough for what I am trying to do. Basically, I am making a little car minigame of a car in a city. This is my engine on the car:

onClipEvent(load){
speed =0 ;
} onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 0.4;
} if (Key.isDown(Key.DOWN)) {
speed -= 0.1;
[Code] .....

I am fine with all of it but the collisions, as the car will only bounce when the registration point of the car collides with 'wall', so it looks all funny and that and the car goes into any thing collable half way then bounces back, and occasionally gets stuck in the wall. Reall annoying. Ive tried fixing it but whenever I remove the hittest parts the car wont even move or turn. How to get the wall collides with the car (27.7 x 13) and not the registration. I need a strong engine which works with curves as well, and requires me just putting the code into the car, but if I have to put it into the walls/frame i suppose its okay, but theres no way im going through every single building and that.

Also, it would be cool if:
-An engine where when reversing the steering is reversed (like irl)
-The car doesnt bounce backwards when driving at a wall at an angle, but slides against it (like irl).

View 9 Replies

ActionScript 2.0 :: Psuedo 3d Collisions Using Spheres

Feb 29, 2004

I'm having a bit of trouble with psuedo 3d collisions using spheres. I'm using _xscale and _yscale to emulate the z-axis (no horizon point), and am having trouble determining the distance between the objects on the z-axis based upon their relative scales.I'm not concerned at this moment with creating new vectors based upon hit angles, just getting the z-index collision detection working. (I also need to tweak the code to prevent trapping, so much todo)Here's the code, the issue is how do I determine the correct value for the z-axis in the hittest?note-this only works when I publish in flash6 when using mx2004, the collision detection doesn't work at all when published for flash7?[code]

View 7 Replies

ActionScript 2.0 :: Test Collisions Than HitTest?

Mar 15, 2007

Is there any faster way to test collisions than hitTest? I remember an example here on kirupa, but I can't find it.

View 1 Replies

ActionScript 2.0 :: Velocity - Collisions At An Angle

Aug 14, 2008

I can sorted Vertical and Horizontal collision. But I'm having trouble with collisions at an angle, e.g. a 45 degree ramp. My cousin says I have to work out the trajectory angle from the Xv and Yv but the closest I can get is:PHP Code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Undetected Collisions In Loop?

Feb 9, 2009

I've been experimenting with circle vs. circle collisons. Ive been using the code below to check for collisions and seperate the objects.It works just fine, except in conditions where more than two circles are touching at the same time. For example, if three circles or more are colliding at the same time, they can sometimes overlap and then struggle to separate.

I think I know why this is happening. The code loops through the object array and checks for a collision between each object one at a time and alters their positions and velocities. The problem is that if it finds a collision between objects at the end of the array, the positions of the objects could be changed in such a way that they cause an overlap with an object that was checked earlier, for which no collision was detected. This new collision then goes undetected and this flaw is amplified when the loop runs again.

Code:
function circleCollision(circleOne:MovieClip, circleTwo:MovieClip):void
{
//Find radius, x and y positions of circleOne
var circleOne_Radius = circleOne.width/2;
var circleOne_X = circleOne.x;

[code]....

View 3 Replies

ActionScript 3.0 :: Break Out Clone Collisions

Mar 20, 2011

Im trying to make a breakout clone which I have working however I cant figure out how to test which side of the blocks the ball hits. I woul like to have a different reaction if it collides with the right side than if it hit the bottom etc.

View 2 Replies

Data Integration :: Php Data Correct On HTML Output But Output To Flash Is Incorrect?

Jun 22, 2006

var nextY = 0;
var nextY2 = 18;
for (var count = 0; count < result_lv.typeCount; count++)
{

[code]....

The type count is correct but the information for the project is wrong.

View 1 Replies

ActionScript 1/2 :: Use The HitTest Function To Check For Collisions

Apr 17, 2009

I know you use the HitTest function to check for collisions, but how would I do that the moment a movie clip is dynamically created. So the moment the clip is created it would check if it is overlapping another clip. Also, does it matter if the clips are at different depths?

View 1 Replies

Flex :: Detect Visual Collisions Between Objects?

May 3, 2010

I would like to avoid the tags overlapping each other in this small Flex project: I've this small FLEX project: [URL]..

The items are LinkButtons. How can I check if they are colliding or not ?

View 1 Replies

Flash :: Using A Custom Event To Listen For Collisions?

Feb 13, 2012

I'm new to flash and programming in general but am learning it to make games. I'm currently messing around with hit detection and its not to hard to test in the game tick ( fired from onEnterFrame). What I'm wondering is if it would be possible / useful to create a custom event that i can listen for. And make the eventListener hear when a collision happens. Also would this be better or worse for the cpu than testing the collisions of lots of enemies on a screen?

View 2 Replies

Actionscript 3 :: HitTestPoint() Not Testing For Collisions Correctly?

Feb 22, 2012

I'm writing a game and it has enemies and bullets. When a bullet hits an enemy, I want to destroy the enemy and the bullet. I'm using the hitTestPoint() method to test if a bullet has hit an enemy. Here's the code in my game loop:

[Code]...

The problem is, hitTestPoint only returns true if both the x and y values of bullet and enemy are the same, rather than if the two movie clips overlap. This leads to bullets going right through enemies but it not registering as a hit. Perhaps I'm missing a bounding box?

Is there a way I can make hitTestPoint return true if the bullet hits the enemy at all rather than only if the bullet and enemy co-ordinates are the same?

View 2 Replies

ActionScript 2.0 :: Avoiding Class Collisions / Overwrites

Dec 30, 2009

I'm working with AS2 and running into a problem when loading a bunch of SWFs that share classes. I have a main SWF that loads several child swfs. The main and the children often share some core classes. The issue is that these SWFs were not all created at the same time, and some of the core classes have changed between SWF compilations. It appears that the first instance of any class to load gets used for all following references to that class - regardless of which version of that class was used in compiling the following SWFs.In AS3, the ApplicationDomain can be set to circumvent this issue, is there any that can be done in AS2 to avoid this collision/overwriting?

View 9 Replies

ActionScript 2.0 :: Testing For Collisions Between Rotated Objects

Oct 14, 2006

I'm writing a general physics engine and I've come across the problem I've always had with flash. So far all my hittests in my physics engine have been calculated by using x/y coordinates and the 2 objects dimensions. This has worked fine for the objects so far because they have been very square-ish and do not rotated. How ever now I am trying to detect if 2 rotated objects are hitting. How can I do this ? I would really like to avoid using any .hitTest() functions.

View 5 Replies

ActionScript 2.0 :: Draw Lines And Detect The Collisions?

Oct 22, 2007

I am looking to create a drawing component on a site. that should be straight forward.the issue lies with the fact that I would want to detect any collisions say (4) and then attach MC's to the collision points.in a nut shell.can I get a trace of the drawn path on the stage?????from there I guess I can detect any positional similarities?

View 8 Replies

ActionScript 3.0 :: How To Stunt Pilot-esque Collisions

Sep 4, 2010

I know how to do various types of collisions and also know how to scroll a background. I'm sort of having trouble putting two and two together for how a game like stunt pilot knows if a plane has gone through a ring vs hitting it... It's for an iphone game (objective c w/ sparrow framework) just I figured it would be easier to figure out in flash then I can bring that knowledge over to my iPhone

View 1 Replies

ActionScript 3.0 :: Multiple Collisions - Create An Array For The Rock?

Sep 22, 2011

its me again I posted destroying MovieClips a few days ago now I'm working on the same project (you can probably tell I'm a beginner) and a new problem occurred I need a way to test if the EvilSlingFuzit collides with a rock, but there is more than one rock. I tried to create an array for the rock, but the rocks are created by the SlingFuzit so the Sling fuzit would have to do something like this:

[Code]...

View 0 Replies

ActionScript 2.0 :: Detect Collisions Between Movie Clips And A Line?

Nov 26, 2004

How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.

View 1 Replies

ActionScript 2.0 :: Bitmap Hit Testing - Pixel Perfect Collisions

Mar 31, 2007

I have been desperately searching for a way to do pixel perfect collisions, and for someone to explain it to me in detail. explain the code in the .fla file, posted by the Canadian in the frequently asked questions thread on bitmapData hit testing:

[Code]...

after looking through the help files, i must admit they are terribly vague. All you are doing is checking if _alpha is above a certain amount. With movieClips you would use 0->100 but with this hittest you have to use 0->255 (0x00->0xFF)so an _alpha of 50 would correspond to approx 128 (0x80). Nearly all the time you could just use 1 as a hittest parameter so you are checking for any hit at all but maybe you have a shadow in a mc layer and you do not want to check a hit. This is when you might be able to use your threshold parameter. In other words, the hit test will only react to parts of the bitmap which have a greater or equal alpha than the alpha threshold, mostly useful for a shadow.

View 1 Replies

ActionScript 2.0 :: Accurate HitTesting Updating Arrays With Collisions.F8 CS3.zip?

Apr 25, 2008

I have 4 ball movie clips, a playhead and four target movieclips called mc_1-4, the array, (my_array), has 4 elements, which are each defined as having values of 0: I have a hitTest set up that will trace my_array to the output window each time it hits mc_1, to see what is happening. However the hitTest prints the array 3 times?

Am i right in thinking that this is because the hitTest is being triggered on entry of mc_1 in the center and upon exit?I need to make this hitTest be triggered once when the hitTest passes the center of mc_1. Secondly if any of the balls have been dragged and dropped on to mc_1 i want the array value with an index of 0, to change to 100 from 0 (not in terms of its index position because my array is only 4 elements long, in terms of its actual value) which i have tried to implement but i cannot configure the right code.

1. hit tests that only trigger once when they pass through the center of the object thus tracing one array.

2.use the balls 1-4 to make the array index 0, have a value of 100 if they are in contact with mc_1.

View 4 Replies







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