ActionScript 2.0 :: Circle Collision Turns Into Attraction?

Nov 14, 2009

I have a whole heap of circles which are user created and they all bounce off one another. Generally it works fine but occasionally two balls join together and sort of .. orbit each other.

my collision code is this: (it's within two loops going through an array of movie clips, where mc1 is the current movie clip in the first loop and mc2 is the current movie clip within the second loop)

ActionScript Code:
dx = mc1._x-mc2._x
dy = mc1._y-mc2._y

[Code].....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Circle Circle Frame Independant Collision Reaction?

Apr 10, 2010

Trying to do circle circle collisions via math which I'm really having trouble with. One circle (player) just moves from keyboard. The ball reacts to the player. All the code shown is in my players class and I passed in a reference to the ball.

On my enterframe I have:

Code:
var xmov1 = xSpeed;
var ymov1 = ySpeed;
var xmov2 = ballRef.xSpeed;
var ymov2 = ballRef.ySpeed;

[code]....

Perhaps I'll go with a box2d equivalent instead of trying out my own physics shenanigans.

View 2 Replies

ActionScript 3.0 :: Circle-circle Collision With Rotation?

Jul 5, 2010

Does anyone know of any tutorial or code example that deals with resolving circle-circle collisions including rotation?

View 2 Replies

ActionScript 3.0 :: Circle And Rectangle Collision?

Mar 22, 2009

most efficient way to test for a collision between a circle and a rectangle?

View 3 Replies

Actionscript 3 :: Box To Circle Collision - Continue Moving And Never Collide When Swapping Values Around

Feb 24, 2012

I'm trying to implement a aabb to circle collision.

[Code]...

Somehow the collision does work as expected. Either they never move at all and "collided" was traced, or they'll continue moving and never collide when I tried swapping values around. Is there something i'm missing in my logic??? My box-box and circle-circle collision are working fine.

View 2 Replies

ActionScript 3.0 :: Mouse Rotation/attraction Effect?

Sep 12, 2009

I am trying to create a effect using AS3. The effect is that several arms should rotate towards the mouse, and rotate less when their further away from the mouse cursor.using Math.atan2 to find how much the arm nedd to rotate to point against the mouse, and then substract the distance from the mouse.(look at the following picture) For example, if Math.atan2 returns 100 and the distance from the mouse is 40, the arm would rotate 60. Thats what i thought.But i cant get it to work. I attached the source files if you want to help Note:A blue ring in the source file indicates the distance.

View 2 Replies

ActionScript 3.0 :: Change Code And Create Attraction Effect Instead Of Push?

Aug 25, 2010

Is there a way to change the code and create attraction effect instead of push effect?

View 0 Replies

ActionScript 2.0 :: Objects Of Attraction - Towards The Mouse Cursor Within 100px And Return To It's Point Of Origin

Oct 29, 2006

How do I take Object_MC and have it attract towards the mouse cursor within 100px and return to it's point of origin when the mouse is 101px + away from the cursor, all while doing an "elastic" like recoil effect, and going from 50% alpha to 100% over that distance to the mouse?

View 1 Replies

ActionScript 2.0 :: Calculate The Direction And Speed A Circle Has After Colliding With A Static (non-moving) Circle?

Mar 8, 2005

I'm developing a game atm, and I need some help on the mathematics/coding of colliding circles (and their change in x/y speed). What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision

If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled. Does anyone here have any insight, links or tips on how I can du this?

View 6 Replies

ActionScript 2.0 :: Make One Circle Follow The Mouse Cursor Inside Another Circle

Sep 30, 2005

i want to make one circle follow the mouse cursor, inside another circle. Similar to an eye looking at the cursor. Ive attached an example.

View 4 Replies

ActionScript 2.0 :: If Statement / Variable - Say If Circle Shows Up Change It To Circle (french)

Nov 5, 2008

I have text in a dynamic field showing up as circle. I want to say if circle shows up change it to cercle (french).

[Code]...

View 1 Replies

ActionScript 2.0 :: Calculate Direction And Speed Circle Has After Colliding With A Static Circle?

Mar 8, 2005

What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision.If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled.

View 6 Replies

ActionScript 3.0 :: Graphics - Paint (change Color) Inside Of Circle When A User Draw A Circle

Aug 24, 2009

I`m working on a app that you can draw lines.....like circles, rectangles... my problem is when a user draw a circle for example....i wanna be able to paint (change color) inside of this circle. I`ve tried working on Shapes with cacheAsBitmap = true and Bitmaps with BitmapData but it doesn`t seens to work.

View 4 Replies

Actionscript 3 :: Change Shape Of Circle By Dragging Point On Circle

Mar 16, 2012

I want to create circle, and put 8 points on it. So, user can drag each point in order to change it's shape.

Is there any way to do this in flash?

I have some following code:

Ref. - How to draw a continuous curved line from 3 given points at a time

package{import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;

[Code].....

So, can anyone convert these three point curve line to 8 points circle?

View 1 Replies

ActionScript 2.0 :: Drawing A Circle - Circle Diameter Has To Be Controlled By A Button

Oct 6, 2009

I have to draw a circle using action script. The Circle Diameter has to be controlled by a button.

View 0 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 =

[code]......

View 1 Replies

ActionScript 2.0 :: Start Drawing First Circle And When First Circle Is On Half Way?

Sep 19, 2004

Here I what i need is : Start drawing first circle and when first circle is on half way, Start second circle.same way second and third circles. and after completing 3 circles, just gotoAndPlay 2nd Frame .

View 3 Replies

Professional :: Circle No Longer A Circle On Publish?

Feb 18, 2010

I have a simple three ring animation where the three rings fade in and out.On the stage the rings are a perfect circle, in the publish preview they look fine, but once I publish the SWF, all of the sudden the rings are not perfectly round anymore.
 
They are almost perfect but right at the top and bottom there is just a small portion which has sort of "flattened out"...

View 2 Replies

Professional :: Create A Circle With The Circle Tool?

Apr 26, 2011

I bought a Flash video tutorial online for Animating and the FIRST step is to create a circle with the circle tool, and the guy does it online, and it fills itself in. I repeat his actions exactly and I cannot get the same result at all. I just get a circle.

View 5 Replies

ActionScript 2.0 :: Moveable Circle Around Another Circle - No Overlap

Apr 5, 2007

I have two MC's, circular in shape. One of the circles is stationary and you can drag the other. I'm trying to get the moveable circle to be able to move around the circumference of the stationary circle, but not overlap. I'm able to detect when they overlap, not using hittest. I just can't figure out how to code it so that the draggable circle can't be moved over the stationary circle.

View 4 Replies

ActionScript 3.0 :: Constrain Circle In A Circle On Startdrag?

Jan 6, 2012

I have been trying to get this right for hours now it cant be as hard as I am finding it! but basically I have a circle and in that circle is a circle and all I want is for the inner circle to not be able to leave its parent. that's it but I just cant get it to work.

View 1 Replies

Actionscript 3.0 :: Create Attraction Effect Instead Of Push Effect?

Aug 25, 2010

is there a way to change the code and create attraction effect instead of push effect?i tried but without success...!

View 1 Replies

ActionScript 3.0 :: Make A Circle Slide ( Slider That On The Shape Of Circle Instead Of Vertical And Horizontal Slider)?

Jul 3, 2009

I'd like to make a circle slide ( Slider that on the shape of circle instead of vertical and horizontal Slider) like this one:

[URL]

Is there a ready Component on the web.

View 0 Replies

Bmp Image Turns Into A Red Square?

Feb 23, 2004

I've been using flash for a whopping 3 days now, and I've stumbled onto a problem that I can't seem to find a way around. I'm using flash 4, due to the fact that #1 it's all I've got, and #2 the new flash mx 6 won't run on the old ass computer I'm using. This is my problem: I import a .bmp image and edit it in flash to make portions of it animated. The image is a symbol (I think it has to be anyway to animate it...) Everything runs fine when I use the basic play/rewind buttons to test the animiation, but when I make it into an executable, or when I go to the menu and hit "Test Movie", the image shows up as a red square. The animation I added still runs, but the actual image I imported is a red square.

View 5 Replies

ActionScript 3.0 :: Detect When The Cursor Turns To A Hand?

May 17, 2011

I would like a function to run when a user clicks anywhere on stage. But this function should not run when the click is on buttons & on url:s inside a dynamic html-formated textfield. How can I detect this? I do realise that the cursor turns to a hand when you hoover over a url inside a textfield & you can set the hand to appear on buttons as well (which i always set it to do). So is there a way in realtime to detect when the cursor is & is not a hand? I've tried the following:

Code:
btn_mc.buttonMode = true;
stage.addEventListener(MouseEvent.MOUSE_DOWN,down)
function down(E:MouseEvent)

[Code]....

View 2 Replies

ActionScript 1/2 :: Html Turns To Percent Signs?

May 28, 2009

I am trying to load html into a text box from a website. when i load to the text box, everything goes fine except that it is loaded as something that looks like this:
 
"%20Cheese%20Croissant= %3B%3Cimg%20src=%22http%3A%2F%2Fwww%2Ehousi ng%2Eumich%2Eedu%2Fdining%2Fmenus%2Fm%2Dfit%2Egif%22%20alt%3D%22%2A%22 %3E%3C%2Fdiv%3E%3Cdiv%20class%3D%22Desserts%22%3EOat%20Bran..."

I wouldnt mind if the html tags were there, because I can deal with those, but I don't know what to do with this. Here is my loader:

[Code]...

View 8 Replies

Within MovieClip - Pasteboard Turns To Color Of Stage

Jul 14, 2009

Flash CS4. When I enter a movie clip to edit the timeline the pasteboard turns to the color of the stage. The result: I can't see the edges of my stage. This is only within the MC. And only within one particular MC (I created another one and the pasteboard stayed 4% gray). When I take the content in the bad MC (via copy frames) and move it to the good one, the same thing happens: Pasteboard turns to the color of the stage. I've tried SFT-CTL-ALT double click. No luck. Strangely, this isn't happening in every FLA. I know it must have something to do with the content on that timeline, but what that is I have no idea.

View 3 Replies

Arrays :: All Color Values Turns Into CurrentColor

Feb 20, 2011

I'm trying to make an array with different color values. My problem is that when I do...
teamColor[i] = currentColor...
All color values in my array turn into the currentColor. (I would upload more code, but that would be a massive mess, considering that I have code everywhere with references from movie clips that are as far as 3 layers deep. However, this would be irrelevant anyways (probably), because I tested this with color values on my main timeline, without any references to or from anything deeply nested). I would like to add that I tried adding strings in there and that the strings remained their original, intended, value, while the color exhibited the same phenomenon.

I changed my code by creating separate variables for each color instead of putting the variables into an array (not what I really wanted to do, but it works). My code looks like this:
if (teamColor != 0) {
this["team"+teamColor+"Color"] = new ColorTransform(0,0,0,1,currentColor.redOffset,currentColor.greenOffset,currentColor.blueOffset,)
teamColor = 0
namebox.addboxes()//function in a movieclip
}

TeamColor is now an int that is changed based on which box a user clicks from a movie clip that has a dynamically generated name, based off of what the variable value in a loop was when it was created.
(E.G: 'tempboxname[ttns].name = i;')
teamColor is then equal to that name when the user clicks it. I have another movieclip with colors in it and the above function is called to check if any teamColor change has occurred, and if it has, act accordingly. (The idea of having teamColor equal to 0 is so that if the user clicks twice, nothing changes. I other conditionals for other colors, all within the same function). That is how I fixed me code. It's not what I wanted, because it's not an array (meaning a seemingly infinite number of teamColors, and thus, teams) but it'll do for me.

View 2 Replies

ActionScript 2.0 :: How To Make Knob That Turns Volume

Jan 11, 2009

i want to create an mp3 player with volume ,frequency, bass, treble and speed knobs any pointers to any scripts that might help me would be great, but at the moment i am just trying to work out how to make a knob that turns.I assume i would use drag over and some kind of rotation function.

View 0 Replies

ActionScript 3.0 :: Tweener - Mouseout Turns Off OnClick

Sep 1, 2009

Basically, I have a button that when moused over it makes rivers go to 50% opacity (they start at 10%), then when clicked they go to 100%.
What I want: Then the rivers stay at 100% until the user clicks the button again.
What is happening: Currently though the mouseout is fading the rivers back to 10%. I know that my code is telling it to do that and want to know how to make it stop.

Here is my code for this:
function shipMouseOver(event:MouseEvent):void {
Tweener.addTween(rivers_mc, {alpha: 1, time:2});
Tweener.addTween(this.dashboard_mc.ship_btn, {alpha: 1, time:2});
} function shipMouseOut(event:MouseEvent):void {
[Code] .....

View 1 Replies







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