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


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 :: 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

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 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 3.0 :: Way To Enable A Grab Hand Cursor?

May 4, 2010

i know this can be done through custom cursors.. i can write up a class to listen for mouse move/over and then show the hand symbol by hiding the original.. but is there any other way which avoids use or writing enter frame/mouse move type listeners...something like

Code:
mc.buttonMode=true;
mc.enablecustommousecursor=true;

[code].....

View 7 Replies

Actionscript 3.0 :: Way To Change Cursor To 'Grab Hand'

Feb 5, 2010

Can you just confirm for me that the only way to change the cursor to a "Grab Hand" (ie an open hand rather than a pointy finger) is to make a custom cursor?

View 3 Replies

ActionScript 2.0 :: Change The Cursor To A Grab Hand?

Nov 26, 2005

on this [URL] excellent site you can grab and throw each book.. how does he change the cursor to a grab hand?

View 7 Replies

ActionScript 3.0 :: Direction Of Ball Same As Of Cursor Mouse

Mar 17, 2011

I have a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..

ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.ui.Keyboard;
var dist:Number = 0;
[Code] .....
How to make that first ball did not change its direction and continued to fly in the direction of the shot?

View 1 Replies

ActionScript 2.0 :: How The Ball Stretches More The Faster Move Cursor

Mar 23, 2007

I like how the ball stretches more the faster you move your cursor. How is that done?[URL]

View 2 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 1/2 :: Stop Ball Depending Upon Speed?

May 24, 2010

I want to stop ball depending on the speed. when i will set the ball speed that time i want to move this ball on this speed.

[Code]...

View 1 Replies

ActionScript 3.0 :: Stop 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]...

View 2 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 :: Get Object To Follow Cursor And Stop?

Jan 7, 2010

I am trying to get an object to follow the mouse cursor only when the cursor is within a certain range of the object.

I would also like the object to stop when the cursor is directly over it, so that it becomes a selectable button.

Lastly, I would like to apply this to many objects, that don't overlap, but rather, "bounce off" of one another. An example of this is at

[URL]

The code I have so far is:

ball_mc.onEnterFrame = function() {
var xMouse = _root._xmouse;
var yMouse = _root._ymouse;

[Code]....

"ball_mc" of course, is the instance name of the object that I have created.

View 4 Replies







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