ActionScript 2.0 :: Stopping A Bouncing Ball?

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


Similar Posts:


ActionScript 2.0 :: Make A Ball Bounce Off Something Like A Ball Bouncing Off A Bumper In A Pinball Game?

Jun 20, 2006

i wanna ask how do i make a ball bounce off something like a ball bouncing off a bumper in a pinball game? i've tried a lot of times but everytime the ball get stucked to the box and it doesn't move anymore...will be grateful if anyone noes the actionscript of it..

View 3 Replies

ActionScript 2.0 :: Ball Bouncing Off Paddle?

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

IDE :: Bouncing A Ball Off A Wall Object

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

ActionScript 2.0 :: Ball Is Not Bouncing Off The Wall?

Apr 12, 2005

below is the code I am useing I have created a simple frame with 2 layers one named body and one named Code in the code frame I have

[Code]...

In the body I have 4 walls all named top bottom right and left they are movies and they are named in there instance the same I have a circle I named ball and made it into a movie and named it ball yet when I run the flash file the ball flys off the page and doesnt bounce inside the boxes?

View 7 Replies

MX04 Bouncing The Ball For Brick Breaker?

May 15, 2009

I am currently making a brick breaker game, so I want to make the ball bounce from the paddle. My paddle's name is pwn and the ball's name is ball.

My code for ball is currently:

onClipEvent (enterFrame) {
this._y += 5;
this._x += 4;
}

[Code]....

I just want the ball to bounce somewhere else other than stopping the ball at the place. I already made sure the paddle can move and the boundaries block the paddle from leaving the stage. So can someone give me the codes (please simple for me to copy-paste) for having me to bounce the ball some opposite direction or whatsoever. Like once the ball touches the paddle, it reflects somewhere else at the same speed and a different direction without any errors.

View 1 Replies

ActionScript 2.0 :: MX Bouncing Ball In Slow Motion?

May 22, 2010

What I need is a ball to be bouncing. It needs it needs to slow down when it reaches its peak and increase speed as it falls. It needs to bounce forever at the same height. And last ... I need a button to make the ball look like its moving in slow motion (while still bouncing at the same height).

This is the closest I have come to getting it right. if you click the button when the ball is at its peak it works. but if you click any other time the ball will fly up to far (it needs to bounce the same height when in slow motion and in regular motion).

movieclips - "ball", "ground"
button - "btn"

[Code].....

View 1 Replies

Flash :: Bouncing A Ball Off 4 Walls Of A Stage

Jan 5, 2010

When I bounce a ball off the walls of the stage using the following technique.[code]Not only is the ball jumpy and skippy. but after so often it begins to go either in a vertal motion y = 5; x = 0; or a horzontal motion x = 5, y = 0. And stays that way. Why is it that the first method works fine but the other method works terrible. Could it be because the Math.cos and Math.sin returns very large decimals.I really prefer to use the second method.

View 5 Replies

Actionscript :: Keep A Bouncing Ball Centered In Stage?

Mar 8, 2011

I have a ball bouncing on a paddle. I want the "stage" to move vertically in order to always keep the ball centered.

View 2 Replies

ActionScript 2.0 :: Bouncing Ball With Movement And Rotation?

Feb 28, 2010

I 'm looking for something like this but for free [URL]

View 0 Replies

ActionScript 3.0 :: Bouncing Ball Off Edges Of Stage?

Jun 22, 2009

I have recently started Learning Actionscript 3.0 out of my own interest. I was trying on making a ball bounce off the edges of the stage using the Actionscript 3.0. But the code not working. The Ball happens to move on X and Y, till it hits the end of the stage, and then it just does not reverse its direction to give the effect of bounce, it gets stuck to the X axis and moves out of the stage. I tried to make changes, but failed.

Code:
function bounceBall(evt:Event):void {
var vx:Number=Math.random()*10+5;
var vy:Number=Math.random()*10+5;
var radius:Number=mcBall.height/2;
var top:Number=0;
[Code] .....

View 2 Replies

ActionScript 3.0 :: Bouncing Ball Script With A Few Specifics?

Jul 29, 2009

I'm looking for a bouncing ball script, but one which is easily editable. I'm not a coder of any sort, but I can work out small sections of script.Basically, I want somewhere to set the number of balls, somewhere to set the speed and somewhere to set rotation. The objects I will be using will not be completely spherical, and need to look natural as they bounce off each other and off the walls, rotating as they do so.So, to clarify, I need an actionscript file that:

* Allows me to create objects that will bounce off all four walls. Gravity isn't a requirement.

* Allows me to create objects that have collision detection, allowing them to bounce off each other and rotate as they do so.

* Allows me to have the objects bouncing as soon as the flash file plays. In other words, clicking and dragging is not a requirement.

* Allows me to create x amount of objects at a randomised size.

* Allows me to specify the speed of the objects.

* Allows me to specify the rotation speed of the objects.

View 1 Replies

ActionScript 3.0 :: Flash Ball Bouncing Around Screen?

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

ActionScript 1/2 :: Bouncing Ball - Move Object Using Arrow Key

Aug 19, 2009

I'm using the actionscript below to Move Object Using The Arrow Keys and it works fine but I want to modify it so that when I press the up key it goes to and play a movie clip. Basically it's a ball movie clip that responds to the arrow key but on the up key it plays a bouncing movieclip and everything remains aligned.

Here is the script-
var speed =5;
this.onEnterFrame =function(){
if(Key.isDown(Key.UP)) {
circle._y -= speed;
} if(Key.isDown(Key.DOWN)) {
circle._y += speed;
} if(Key.isDown(Key.LEFT)) {
circle._x -= speed;
} if(Key.isDown(Key.RIGHT)) { 
circle._x += speed;
}};

View 13 Replies

Actionscript 3 :: Flash - Animate A Ball Bouncing On The Z Axis?

Feb 25, 2012

trying to animate the ball in 3d space. Is there a formula for this?

var xPos:Number = tennis_ball.x;
var yPos:Number = tennis_ball.y;
var xVel:Number = (Math.random() * 10) - 5;

[code]....

View 1 Replies

ActionScript 3.0 :: Stop A Ball From Bouncing Up And Down When I Grab It With Cursor?

Apr 29, 2011

how to stop a ball from bouncing up and down when I grab the ball with my cursor?Currently, I have two sections of code, one for a drop and drag, and one to reenact the effects of gravity on my ball.I don't want the ball to start bouncing right away,I want it to either start bouncing when I drag it and let go, or start bouncing when I click a button.I would also like it to STOP bouncing altogether if I grab the ball. (because even though I can drag it around, the bouncing animation is still running!)Here's my current code: (With one "ball_mc" on the stage)

// creating some gravity
var spring:Number=.1;
var frizione:Number=.98;[code]........

View 1 Replies

ActionScript 2.0 :: Bouncing Ball With Slow Motion Button?

May 21, 2010

I have a ball bouncing that works great. What I want is a button that will make the ball look like its in slow motion (while still bouncing at the same height) and another button to put it back in regular motion. After hours of experimenting I still couldn't get it perfect. The following code is on the ball movieclip.

Code:
onClipEvent (load) {
var acceleration = 0.005;
var termVelocity = 20;

[Code]......

View 9 Replies

Full Screen Bouncing Ball Will Not Reflect Off Stage Wall?

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

ActionScript 3.0 :: Buttons To Fall And Bounce To The Ground Like A 'bouncing Ball'?

Feb 24, 2012

So in my level 1, here's what I wanted it to look like:on enter frame, a few of my "drag-gable" buttons are going to fall to the ground, bounce a little bit and stop when they ran out of speed.Attached the file that I've already scripted the drag n drop on each button, now how do i script the "fall to the ground part"?

View 0 Replies

ActionScript 2.0 :: Bouncing Ball Effect Over Text (Karaoke Algorithm)?

Nov 8, 2004

I am trying to work out a way to achieve the bouncing ball effect over text known from karaoke players? I would like this to be done programmatically with actionscript, so the ball follows the text and the soundfile (looking for pauses or DB rises?maybe not). I have heard its a question of finding the right algorithm? Its use will be in a language lab-like flash app based on Communication server, where the user can :

1) Hear the correct pronunciation of a sentence (with bouncing ball over text)
2) Record their own voice
3) Compare the two

View 1 Replies

ActionScript 2.0 :: Bouncing Off Walls - Stopping Movement When Hittest Occurs

Dec 14, 2003

If you take a look at this site Game 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

ActionScript 3.0 :: Stopping Ball At Mouse Location

Dec 22, 2009

i have made a simple application to move a ball to the location of the mouse. I am trying to adjust my app so that when the ball does move in the same position as my mouse location, it should remove the listener showing that the ball does reach my mouse's destination.

Code:
package
{
/**
* Zenos.as is meant to show how you can demonstrate friction using the Zenos

[Code].....

View 3 Replies

ActionScript 2.0 :: Make A Bouncing Image That Resizes During Bouncing?

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

ActionScript 3.0 :: Ball Collision Inside Another Ball Using Gravity?

Jun 5, 2009

ball collision inside another ball using gravity.I have one large circle in the middle of the stage (its radius is 150 pixels). I have another circle inside of that one (20 pixels radius), this is the smaller ball that I would like to have bounce around inside of the larger one with gravity. When the small ball hits the edge of the larger circle, I would like it bounce inwards to the center of the larger circle. It keeps doing this until it eventually stops in the center of the larger circle at the bottom.

View 1 Replies

ActionScript 2.0 :: Drag Throw Scroller - Ease Into Place Stopping And Showing The Second Image Stopping The Image At X Axis 0

Feb 18, 2009

I want it to while still easing into place like the iphone does. For example my stage is 550px. The drag and throw MC is 1650. That's 550x3. If the first image is showing starting at x axis 0 and you drag to the left it will ease into place stopping and showing the second image stopping the image at x axis 0. And the same thing scrolling to the next one and scrolling back. So the code is below and I've attached the movie that I'm working on.

[Code]....

View 8 Replies

Actionscript 3 :: Stopping Sounds Without Stopping Bgm?

Dec 25, 2011

flash pro. as 3.0.animation . almost no codes except ends of scenes having :

import flash.media.SoundMixer;
if(SoundMixer.areSoundsInaccessible() == false)
{
SoundMixer.stopAll();
}

[Code]...

i got this scene, with this specific bgm , individual frame layer. and the sounds at another layer. what i want is to stop the sound without stopping the bgm . (yes, i know the above code wouldn't work as it stops all sounds)

View 1 Replies

Flash - Calling The Function Within That Function And Later Stopping The Loop - Starting And Stopping Functions?

Jan 7, 2012

I am making a character walk. This code will make him wobble to the right and when thats done it will trigger him to wobble to the left and then call the function again to continue the loop.I can get the loop to work fine by calling the function but how do I STOP the function? Also I want to call it later on. Is there a way to start and stop a function?

function wobble()
{
var ws = .1;
var dis = 1;

[code]....

View 2 Replies

ActionScript 2.0 :: Bouncing Off Walls?

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

Flex :: Creating A Bouncing Button?

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

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







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