ActionScript 2.0 :: CS3 Collision - Make The Balls Bounce Off Eachother

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


Similar Posts:


ActionScript 2.0 :: Make Bouncing Balls Bounce Off Eachother?

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

ActionScript 2.0 :: Make Bouncing Balls Bounce Off Each Other?

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

ActionScript 2.0 :: Bit101-collision-agony - Make Them Collide, And Make The Ball Bounce Away?

Apr 13, 2003

I followed the bit101 tutorial on gravity and now have a movie clip called "ball" (instance name) with an embedded invisible button (so you can throw it all over the place).I also have a movie clip called "block1" (instance name too! what a coincidence, isn't life lovely). I want to make them collide, and make the ball bounce away.

View 1 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 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 :: Collision Detection, Stopping Objects From Going Through Eachother?

Jan 16, 2011

I'm running a HitTestPoint to detect when two of my mc's collide, but I don't want them to be able to go right through each other. Someone suggested I find the x,y coords of the moving object when the collision occurs, then update that mc's coords to this x,y each time a collision occurs. I've been Googling but came up empty. Below is my code

private function __checkHit($evt:Event):void {
if (this.coin_mc.hitTestObject(target)) {
if (!hitting) {[code].....

View 2 Replies

ActionScript 3.0 :: Predictive Collision Between Balls

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

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

Flash :: Collision And Bounce Detection From Array Of Points

Sep 18, 2011

I have an array of points that I will use to generate a closed polygonal fence on the outside of a game stage (2D). I wish to have collision detection between this fence and a bouncing ball-like object on the inside. Additionally, I would like to be able to arbitrarily add/remove/redraw the fence in realtime and have the collision detection still operate realistically. I have considered drawing a Sprite/Shape from the points and doing a HitTest at each frame to check whether to bounce or not. My question: is this the best/correct way to accomplish this goal? Consider something like JezzBall with diagonal lines of any angle a simulation of what I'm trying to do.

View 2 Replies

ActionScript 2.0 :: Simulate Collision Of Block And Bounce Like Ball

Oct 12, 2004

I make this simple system to simulate a collision of a block in "walls" and bounce like a pong ball. To use drag the orange square and release to start the movement. But I have a problem, sometimes the collision not happen and the block go through the walls, I try less the time of setInterval that verify the collisions but not solve my problem.
collision system -> [URL]

View 3 Replies

ActionScript 2.0 :: Make MC's Unabe To Pass Eachother

Aug 4, 2006

I have 2 objects, a bouncing ball and a barrier. How do i make it so that the ball may not pass the barrier? It seems that no matter what I do, there are circumstances in which the ball does pass the barrier.

View 14 Replies

ActionScript 2.0 :: Make Balls Fall Down When Button Is Pressed?

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

ActionScript 3.0 :: Events And Listeners - Load Info From A File And Make Blue Balls Rotate Around Given Points?

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

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

IDE :: Make A MC Bounce Off The Sides Of The Stage

Jan 17, 2010

I am just restarting my flash adventures and am trying to learn AS3. I can a real quick code request. I am trying to make a MC bounce off the sides of the stage. When I use the following code, the MC gets stuck going -2 then +2 at the edge of the stage.

[Code]....

How do I get it disregard the first part of the if/else and then go the other direction? know this is a really beginer question,

View 14 Replies

ActionScript 2.0 :: Make A Movie Clip Bounce

Dec 18, 2009

ive been working on boucing code and ive got this

onClipEvent(load) {
gravity = 2;
speed = 0;
}
onClipEvent(enterFrame) {
speed += gravity;
[Code]...

this will make your movie clip bounce. that i need to know is why does it bounce. i cant quite get my head around it. i start of and accelerate, hit 300 on the stage but then go up decreasing my speed by 0.8 every frame..

View 2 Replies

ActionScript 3.0 :: Make The 'cannonball' Bounce Of The Walls?

Sep 10, 2011

I have this game, got various levels. The point of the game, is you have to shoot all the zombies in the level to proceed. But I need it so the 'cannonball' bounces of the walls so there is more of a chance to hit multiple zombies.
 
Incase you wanted to see my document class here it is below.
 
package {
import flash.display.*;
import flash.events.*;
import flash.text.TextField;

[Code].....

View 8 Replies

Flash :: How To Make The Object Bounce Back

Feb 15, 2012

for (var k:int = 0; k < 1; k++)
{
money = new Money;

[code].....

View 1 Replies

ActionScript 3.0 :: Make MovieClip Bounce Off A Wall?

Jan 4, 2010

Imagine loop that contains a ball_mc that bounces off walls for how ever long the loop. I am asking what the math part would be to make the ball_mc bounce off at the correct angle and such.

View 1 Replies

ActionScript 3.0 :: Make A Ball Bounce Around The Screen?

Feb 13, 2011

So I am trying to get a ball to move around the screen, and when it gets to the walls of the stage I want it to change directions. So far, I have this code:

Code:
import flash.events.Event;
var ballVelx:Number = Math.random() * 15;
var ballVely:Number = Math.random() * 15;
var ballDirx:Number = 1;

[Code].....

This is not in the main timeline, it is in the symbol timeline for Ball. With this, I have the ball moving around and when it reaches the end of the stage it resets with a random velocity/angle. When I uncomment the ballDirx and ballDiry lines and comment out the this.x = 0 line, the ball doesn't change directions, it just stops moving when it reaches the end of the stage.

View 6 Replies

ActionScript 2.0 :: [FMX] Make A Ball Bounce Across The Stage

May 1, 2005

I haven't done much actionscript stuff ...and at the moment im trying to make a ball bounce across the stage, but im unsure how to go about doing that.

View 3 Replies

IDE :: Using The HitTest To Make Ball Bounce Off Of The Players

May 5, 2010

I'm having problems with my flash game, i am making slimeball and im using the hitTest to make my ball bounce off of the players, but because my players are semi circular when it hits off the back of my player the ball still goes forward when it should bounce off the player in the direction that it came from, if that makes sense

[Code]....

View 1 Replies

ActionScript 2.0 :: Make A Mc Bounce Then Travel Forward Again?

Apr 24, 2011

I managed to get the bounce working how do I make it continue to move forward after the collision?

View 5 Replies

ActionScript 2.0 :: Make A Ball Bounce Across Stage

May 1, 2005

I haven't done much actionscript stuff ...and at the moment im trying to make a ball bounce across the stage, but im unsure how to go about doing that.

View 3 Replies

ActionScript 3.0 :: HitTestObject : Make A Box That Will Bounce Slowly Between 2 And Repeat?

Dec 2, 2010

im trying to make a box that will bounce slowly between 2 and repeat ( i hope that makes sense 0_o) so far the code i have is

import flash.events.Event;
var speed:int = 3;
var hit:Boolean = false;

[code]....

but one it hits wall 1 it moves 3 pixels to the right and stops =/ i tried changing the if(hit == true) to

if(ball.hitTestObject(wall1)){
ball.x += speed;
}

but it does the same thing.

View 4 Replies

ActionScript 2.0 :: Make Ball Move And Bounce Around Stage?

Oct 29, 2003

I cant figure out how to make the ball move and bounce around the stage. and i also need help on the paddle that the ball bounces off of. if u could help me out that would be awesome.

View 11 Replies

ActionScript 2.0 :: Make A Ball Bounce Off A Wall With The Same Angle?

Mar 17, 2002

I am familiar with hit test, but how do you make a ball bounce off a wall with the same angle that it bounced on it with?ex. it hits the wall at 45 degrees, and it bounces off the wall at 45 degrees

View 6 Replies

ActionScript 2.0 :: Make A Ball Bounce Of A Wall And Stll Carry On?

Apr 26, 2011

i want to make a ball move at a constant speed into a wall and bounce of, initially it should move back but then It should carry on moving towards the wall.

I managed to make it bounce but once it hits the wall it carries on in the opposite direction!

View 4 Replies







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