ActionScript 2.0 :: Bouncing Balls Off Each Other Around Screen
Jun 15, 2004
I've got this ball that bounces around the screen. There are a bunch more that are made with the duplicate movie clip command. I want them to bounce off eachother, as well as the walls. The problem is, I cant just put the code on the original ball because then balls want to bounce off themselves which creates problems. So my question is, is there some kind of loop I can use to make it so each duplicate ball will bounce off the others but not itself?
View 5 Replies
Similar Posts:
Jan 1, 2007
I've been trying to recreate the yugop examplewhere the balls seem to bounce off each otherbut the difference is, they can also rest on top of each other.click to add more balls.
Code:
main.fla
var ballcount:Number=1;
[code]....
View 3 Replies
Sep 28, 2011
I'm looking at creating a game which involves many bouncing balls on the screen, and the user can sortof select one of those balls and take it out... The balls should be able to bounce of eachother and the walls. I've tried implementing this from scratch, following the tutorials at [URL] - but it's not quite working for me, and if I need the game to become more complicated- probably best to use an existing engine. So is there an existing engine that will work very fast and well for this sort of thing? At a glance- it didn't seem like box2d or flixel would work for this... but what do you say?
View 2 Replies
Oct 19, 2004
I have a number of random balls bouncing around the stage.What I am having difficulty with is making them bounce off each other when they run into each other.The balls bounce off the walls just fine, but I can't seem to figure out the hitTest thing.
View 3 Replies
Mar 31, 2012
I now have this but only one ball bounces when the flash movie is runvar array:Array = new Array;var dx:Number = Math.random() * 20;var dy:Number = Math.random() * 10;var velX:Number = 5;var velY:Nu
View 2 Replies
Oct 19, 2004
I have a number of random balls bouncing around the stage. What I am having difficulty with is making them bounce off each other when they run into each other. The balls bounce off the walls just fine, but I can't seem to figure out the hitTest thing.
View 3 Replies
Jan 14, 2011
trying to basically using AS3 to make a ball bounce around the stage but never lose motion and have the chance to speed it up or slow it down through code.
View 3 Replies
Nov 5, 2009
I have added full screen code on my movie so that the user can extend the size of the movie. eg If the user expands the browser window to 1200 X 900, then my movie will become 1200 X 900 without the movie deforming.
Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
[code]....
View 3 Replies
Jul 10, 2008
Do you know any tutorial similar to this one [URL]...y=ActionScript) that shows how to make a bouncing image that resizes during bouncing?
View 3 Replies
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
Dec 12, 2008
I have balls (...sounded pervert) that are created by duplicateMovieClip, yes, they spawn, but right on top of each other, and I don't seem to be able to do anything to them, I tried ball+i.onEnterFrame = function(){} typed in several different ways ("ball"+i, ["ball"+i] etcetc...) And I just couldn't find How to refer to them. i'm trying to spawn them to random positions and make them move in random directions (got the moving part already coded but like I said I can't name them -> can't use it atm.)
Short version: How to refer to balls that are created by duplicateMovieClip?
View 2 Replies
Feb 9, 2012
I want to detect perfect collision between two balls. i mean. when balls move in ENTER_FRAME. their (x,y) are updated with such a large value that it sometimes miss the complete collision. and also how to find the collision point.
View 2 Replies
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
Jul 30, 2011
I want to write a game in which there will be some balls on the stage, that will move randomly. They must have unique starting speed and angle and should interfere with each other just like real billiard balls. Is there any physics engine in AS3 that might be useful for this purpose, or will I have to write and model their behavior from the scratch?
View 1 Replies
Jul 13, 2009
Following is the code I paste in the first frame of layer1..it was working before I added for loop..I am tring to explode all six balls on the stage clicking..but what is missing ?How can I get it work ?
for (var i = 1; i<6; i++) {
ball[i].onPress = function() {
ball[i].gotoAndPlay("explode");
};
}
View 2 Replies
Apr 24, 2011
I want to show the number of balls increasing as the frame numbers increase, and I also want to show them decreasing (reverse the frame no) how can I go about doing this? I also need the current frame to be in the middle of all the total frames so when I go to the right balls wil increase and go to the left balls will decrease..
View 3 Replies
Oct 11, 2009
I have a MC (a ball) with this AS on it:
[Code]...
This bounces the ball off each 'wall'. how to add more balls (using actionscript - ie not copying and pasting on the stage) and to make the balls bounce off eachother too?
View 1 Replies
Mar 25, 2011
I wish to have a numeric stepper which allows me to choose the no of balls I want, then when i press the button I want all these balls to fall down..but when I press the button the x no of balls are generated but not falling down.
View 6 Replies
Jun 6, 2010
I was wondering which is the best way to create 3d graphics in flash like cubes, balls, a 3d cake or anything.
View 2 Replies
Apr 29, 2010
im building a sound toy that has four balls that can be thrown around and will bounce of each other. when each ball collides i have a chord to be played through a hit test for each pair. im having a problem with getting good collisions between balls and also using hit tests to trigger sound.
View 1 Replies
Jun 7, 2010
I have a machine that shoots canon balls into three different barrels, each on a different x axis, I need to be able to shoot at an arc into the target barrel, the target barrel will be randomly determined right before the ball is fired, the barrels will be randomly placed from stage to stage
the friction and gravity applied are constant variables, how can i determine both the correct x and y veleocity to shoot the balls out so that they end up in the correct barrel. I don't want to hard code any variables
View 2 Replies
Nov 30, 2010
I'm trying to make a program that grabs info from a text file then uses the info in the file to assign where certain balls will rotate (eventually I'll configure it to looking like dots rotating around an invisible sphere)Now, I can do these two things separately, load info from a file and make blue balls rotate around given points... but I've been tripping up hard on making them work together, and I think my problem is in how I handle the events and events listeners to work with the code, you'll need to start a new flash AS3 file Then on the stage create a circle with the oval tool convert the circle to a symbol named "BlueCircle" and name the linkage class as "BlueCircle" then paste this code...
Code:
var longLatLoader:URLLoader = new URLLoader();
longLatLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
longLatLoader.addEventListener(Event.COMPLETE, onLoaded);[code]....
View 3 Replies
Dec 14, 2003
then you will see that when you hit the walls or boundrys you "bounce" off them. I have accomplished stopping movement when hittest occurs but how shall I get the car to "bounce" off the walls. It would be great if you could supply the full code as I am not a great coder.
View 1 Replies
Mar 23, 2010
I am trying to make an effect on a button that when I mouse over it, it keeps jumping up and down smoothly and when mouse out it stops. I tried this but the result was really bad:
[CODE].....
View 2 Replies
Jan 15, 2003
i have just came across the tutorial with physics/bouncing ball - so far i have encountered no problems in understanding it, but just a question:how do i stop the ball bouncing? do i have to equal it to a certain value or just drop in another if/else statement, because now the ball seems to bounce forever, since it gets every time multpilicated by a negative number.
View 2 Replies
Nov 2, 2004
I followed the tutorial about gravity, with bouncing, and I wanted to figure out how to test when it has stopped bouncing.
What I am trying to get at is say I had the objet bounce from a point, then when it has stopped bouncing, move left or right. Think of a person dropped from a plane with a parachute. He has to wait until he is firmly on the ground before he can start moving...thats what I want to do.
View 1 Replies
Nov 3, 2006
im was wondering if anyone knows the script for a ball bouncing off a paddle. I want the ball to bounce off the paddle in different directions depending on:
1) which side of the paddle it hits
2) which direction it came from
Ive only got this so far : script for the paddle
onClipEvent(enterFrame)
{
if (this.hitTest(_parent.ball)) //if this movieclip hits the movieclip 'ball'
tellTarget(_root.ball) //tell the ball to:[code]....
View 1 Replies
Sep 19, 2009
I have an image and I want it to have a reflection and to apply an effect onMouseOver so that image bounces (like a rubber ball) until it stops.I found this example (http:url]....)that does exactly what i want (except I want it to bounce just one time per mouse over), but this is for Flex and I cant manage to translate it to Flash.
View 2 Replies
Apr 26, 2010
I have created a flash AS3 file with two movieclips. One is a ball (ball_mc) and a wall (wall_mc). The ball bounces around off the outer walls of the stage, in horizontal lines.
The ball also changes direction if it bounces off the wall. However its not bouncing off the wall in the right direction?
Code:
var dx:Number=3; //the amount the ball will move horizontally each frame
var dy:Number=5; //the amount the ball will move vertically each frame
this.addEventListener(Event.ENTER_FRAME,moveBall); // call the function moveBall every frame
[Code].....
View 6 Replies
Nov 2, 2004
I followed the tutorial about gravity, with bouncing, and I wanted to figure out how to test when it has stopped bouncing.
What I am trying to get at is say I had the objet bounce from a point, then when it has stopped bouncing, move left or right. Think of a person dropped from a plane with a parachute. He has to wait until he is firmly on the ground before he can start moving...thats what I want to do.
View 1 Replies