ActionScript 2.0 :: Two Circles To Bounce Off Each Other Correctly?

Jan 18, 2007

"How do I get 2 circles to bounce off eachother correctly??". I am currently making an air hockey game. I have seen great physics explanations, and great swf's, but I can't seem to do it myself. I know how to get the puck to bounce off the walls, and that code is very stable/simple, but the hitter-against-puck collision is very elusive. Bit-101 has some great swf's on flashkit forums about the exact same thing I am looking for. I have heard of somebody on super samurai giving a great explanation. I have seen a physics student's explanation. It seems to be a lot of code involving the radii of the circles, and the only thing I really understand is this:

r1 = radius of puck | r2 = radius of hitter | d = distance between them
if r1+r2 > d, then they have collided.

Here is my puck-against-wall code:
onClipEvent (load) {
speed = 0;
dist = 0;
dx = 1;
dy = 1;
[Code] .....
So anyway, obviously that code is inside of the puck.

View 6 Replies


Similar Posts:


ActionScript 2.0 :: Randomly Animate Circles Moving Around Inside A Bigger Circles?

May 12, 2005

how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out..

View 1 Replies

ActionScript 2.0 :: Circles In Circles Animation

May 12, 2005

anyone know of any tutorials or any codes on how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out.. yeah, by the way i have attched the file so more or less u will understand wat im saying.

View 1 Replies

ActionScript 2.0 :: Draggable Circles With RGB Mix Add

Nov 29, 2010

I got to create an app with 3 draggable circles. (Red,Green,Blue). At the centre overlay the RGB needs to display the mixed RGB. I.e if red and blue, overlay display magenta. If green and red overlay display yellow. If red, blue and green overlay display white, etc.

View 1 Replies

ActionScript 2.0 :: Make The Circles Go From Down To Up?

Nov 4, 2003

im so lost in how to make the circles go from down to up instead of going left to right.

Tutorail: Creating Continuous Movement

[URL]

Specifically i'd like to know the actionscript code.

View 4 Replies

ActionScript 2.0 :: OOP: Balls That Bounce Off Each Other?

Dec 18, 2006

I have a simple ball class where it bounces and such and stays on the stage based on boundaries. right now im using a for loop to attachMovie("ball",...) in my main fla file
which is basiclaly my movieclip that has the AS 2.0 class pointed to it. It bounces fine using the tutorial on Kirupa(by senocular?) i want these balls to bounce off each other too?

View 1 Replies

ActionScript 2.0 :: How To 'bounce' Movieclip

Jul 5, 2003

I would like to know how to "bounce" a movieclip. Not sure if that is the right term for what I'd like to do.URL...When you click a button the background images kind of bounce into place.I know how to control a MC but how would you make that bouncing effect?

View 3 Replies

ActionScript 2.0 :: Add More Easing And A Bounce?

Jul 11, 2004

I have this code in a button. I want more exaggerated easing, but more importantly, a "bounce." What I mean by this is on rollout, the button seems kinda sticky and jiggles back and forth a little.

code:

onClipEvent (enterFrame) {
if (_root._ymouse > 50 && _root._ymouse < 150) {
_root.yChange = Math.round(_root._ymouse-this._y);[code].........

View 1 Replies

ActionScript 3.0 :: Animate Circles On Random

Apr 29, 2010

I try to animate cricles on random.. Its not working for me.. somewhere the code needs to correct.. Here my code...

[Code]....

View 3 Replies

Flex :: Overlay Circles On Google Map?

Feb 14, 2011

I want to use semi transparent circles to show the intensity of the effect by altering the radius of the circle and animate it while placing them. for example it appears as a dot and then grows to the intended size in fraction of a sec.

I could see some functions in javascript API but not in Flex. Saw some examples that uses polygon. But i dont want to plot all 360 points for just one circle.

View 2 Replies

Flash - Circles Adding Outside Of Square Box

May 9, 2011

import flash.display.Sprite;
var bin:Sprite = new Sprite();
var cir:Sprite = new Sprite();
cir.graphics.beginFill(0x00ff00,1);
cir.graphics.drawCircle(0,0,30);
cir.graphics.endFill();
bin.graphics.beginFill(0xff0000,1);
bin.graphics.drawRoundRect(40,40,100,100,5,5);
bin.graphics.endFill();
addChild(bin);
bin.addChild(cir);
Here why do the circle added outside the square box?

View 3 Replies

Get The Circles Animated To Get The Next Image To Display?

Oct 15, 2011

I can make images transparrent and tween etc. I want to create an animation (like this one), if someone can please help put me in the correct direction? I am not sure how to get the circles animated to get the next image to display.

View 2 Replies

Flash :: Drawing A Shape With Circles

Oct 22, 2011

The issue I am having is how to tackle forming a logo using circles. I have done one letter manually, however it would take forever to do this with every single letter, and so I am asking here if anyone knew of a faster method. Requirements:

- Has to fill non-circular letters(i.e. does not have to be precise, but look like it has edges)

- Circles have to animate in, therefore they need to have drop shadow and seem like they are landing in place

View 1 Replies

ActionScript 3.0 :: Circles That Act As Mask For Picture

Jan 19, 2010

I've got the code for circle on an image (mask). I've got it in my first frame and I need do something else in 2nd frame but after the movie in 1st frame is finished.
Code:
//This container contains all the circles that act as a mask for the picture
var container:Sprite = new Sprite();
//Assign the container to be the image's mask
picture.mask = container;
//Add the container to the stage
addChild (container);
/*

This timer is responsible for creating a circle every 0.05 seconds. A total of 20 circles will be created.
*/
var timer = new Timer(50,20);
timer.addEventListener (TimerEvent.TIMER, createMaskBall);
timer.start ();
//The timer calls this function every 0.05 seconds
function createMaskBall (e:Event):void {
[Code] .....

View 5 Replies

ActionScript 3.0 :: LineTo Drawing Circles?

Jan 31, 2010

I have been working on a drawing "game" in my spare time (which is limited). This is probably a common question, if so I appologize. By the way, I do not have the code here, it is on my other computer. Anyway, I was using the lineTo method and a timer listener to fire the addition of each new line segment, if that makes sense. The problem is that when you try to draw an arc quickly, it looks terrible. It draws straight lines. I tried adjusting the timer, which helps a bit but still not great. I looked at the curveTo but could not figure out a logical way to get the achor coordinates. I did some research online and found some that use addChild with bitmaps. I would rather use lines. Has anyone tackled this before?

View 3 Replies

ActionScript 2.0 :: Draw Circles With Mouse?

Apr 4, 2011

I am looking for a way to draw circles using the mouse using the lineTo method, but need a way to find when collision occurs between the line that you're drawing and the line that's already on the screen.

View 0 Replies

ActionScript 3.0 :: Random Numbered Circles?

Apr 10, 2011

My problem is I need to generate numbered circles ( from 1 to 100) and I need to make them click able. When I click the circles in order (i.e. 1, 2 , 3...etc) the clicked circle should change color or get disabled (to indicate it is clicked). I should not be able to click the next numbered circle until I press the previous numbered circle and there should be a counter to show how many correct circles are clicked.

View 1 Replies

ActionScript 3.0 :: Circles Moving Around Inside One Another

Dec 23, 2011

I am trying to code some circles to move around inside one another. I have managed to do the hit test bit, but its getting them to stop at the edge inside one another is what I am having problem with. The aim is so the user can drag the red circle and the yellow stays where it is within the red, but when you drag the yellow circle the red moves with it.

View 2 Replies

ActionScript 2.0 :: Vibrating Circles - Turn It Off?

Oct 24, 2003

I have used Kirupa's tutorial on vibrating circles and dont know how to turn it off.I am using the circles in Scene 1 and want them to disappear when you enter into Scene 2.

View 2 Replies

ActionScript 2.0 :: Sequence Of Expanding Circles?

Nov 17, 2006

I've been messing with some code from lionbichstudios.com. I'm looking for a way to have 5 circles appear in succession and expand and fade away. Works fine for one circle but I haven't found a good way to create a sequence of circles. The one hitch: the code needs to appear all in one frame. (I'm using Flash MX 2004)

Here's the basic code:

[Code]...

View 3 Replies

ActionScript 2.0 :: Turn Vibrating Circles Off?

Oct 24, 2003

I have used Kirupa's tutorial on vibrating circles and dont know how to turn it off. I am using the circles in Scene 1 and want them to disappear when you enter into Scene 2. I know very little about actionscript and am asking for help. I am including the .fla

View 2 Replies

ActionScript 2.0 :: Make The Circles Go From Down To Up Instead Of Going Left To Right?

Nov 4, 2003

im so lost in how to make the circles go from down to up instead of going left to right.

Tutorail: Creating Continuous Movement

[Url]

Specifically i'd like to know the actionscript code

View 4 Replies

ActionScript 3.0 :: How To Get Only Ball To Bounce On Stage

Nov 3, 2010

I have this code to make a ball bounce. it works fine, however, everything on the stage bounces. I only want the ball to bounce.

Here is my code
/* Actionscript 3.0 Bounce Effect. ball = movieclip instance name*/
var velocity = 0;
var gravity = 2;
var speed = 0.03;
var ground = 300;
Object(this).ball.addEventListener(Event.ENTER_FRAME, fl_bounce);
function fl_bounce(event:Event) {
[Code] .....

View 5 Replies

ActionScript 3.0 :: Making Two Balls That Bounce Into Each Other

Feb 13, 2009

I'm trying to make two balls that bounce into eachother and walls for a school assignment. My problem is I don't really know the maths to make this work myself so I've tried to get help from others who don't know AS but who do know the maths, but I couldn't get that to work. Then I found a site that had exactly what I was looking for, but it was in AS2. I've tried to translate it to AS3 but it doesn't work properly either. The balls either get connected to eachother and stay that way or go out of the stage. This example is here:[URL] Attached my files. Probably lots of redundant code in my code from previous attempts at solving it, but I don't think it affects anything as it is now.

View 2 Replies

ActionScript 3.0 :: Making A Ball Bounce?

Apr 27, 2011

I'm pretty new to Flash and I've ran into a bit of an issue. I'm trying to convert a AS2.0 code into a AS3.0 code, more specifically I'm following this guide:

[Code]...

View 8 Replies

Collision Detection And Bounce Physics?

Jun 15, 2011

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.

View 1 Replies

ActionScript 2.0 :: How To Get Realistic Ball Bounce

Jul 27, 2005

I'm making a ball that are going to bounce realistic..But it doesn't!

View 4 Replies

ActionScript 2.0 :: Make A Ball To Bounce ?

Oct 4, 2005

I'm trying to make a ball to bounce on something realistic.How can I make it work? It's impossible.

View 3 Replies

ActionScript 2.0 :: How To Make Bounce And Squash

Aug 4, 2006

Okay, so I have a movieclip of a letter (done in photshop to look like jelly). I want to animate it to fall from above, bounce on an invisiable plane, squash when it hits, and squash and go back up and decrease it each time until it comes a rest.I have the bounce but I need to squash.

Code
Code:
onClipEvent(load){

[code].....

View 1 Replies

ActionScript 2.0 :: Bounce Of Wall With Direction Changes?

Jan 24, 2007

I have this following situation.Basically, I want my balls to move around a border and bounce off the walls when it hit the walls.

[code]...

View 3 Replies







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