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


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

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

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 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.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 3.0 :: Google - Tweener Can Animate The Z-axis For The 3d Stuff?

Apr 1, 2009

I have been animating with google tweener for a while now in as2, and I just got flash cs4. Does anyone know if google tweener can animate the z-axis for the 3d stuff? If not, how can 3d objects be animated dynamically?

View 14 Replies

ActionScript 3.0 :: Animate Two Images On Axis With RotationX Command?

Aug 15, 2010


I am trying to animated two images on axis with rotationX command. it's working when the picutre comes in 90 degree it gets overlapping. I am attaching the picture for your reference

View 7 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 3.0 :: Construct Coordinates With Distance In Meters On The X-axis And Time In Seconds On The Y-axis

Nov 27, 2011

I am trying to construct coordinates with distance in meters on the x-axis and time in seconds on the y-axis, without using the timeline. How can I draw the divisions on the x-axis and y-axis ? Or I better draw the whole thing.

var my_shape:Shape = new Shape();addChild(my_shape);
my_shape.graphics.lineStyle(3, 0xFF0000, 1);my_shape.graphics.moveTo(50,50);my_shape.graphics.lineTo(50, 300);my_shape.graphics.lineTo(500, 300);

View 9 Replies

ActionScript 2.0 :: Make An Object Move Along Y Axis Once It Has Reached Its X Axis Target?

Mar 2, 2005

I'm trying to grasp how functions and motion tweening works.

Heres my question. How do i make an object move along the y axis once it has reached its x axis target?

HEre is the code, that i got from here.

and what in this code is making the MC ease out?[code]...

View 14 Replies

ActionScript 3.0 :: Tweens Objects Return To Their Original Position - Start Jumping Between Y Axis 200 And Y Axis 83?

Aug 7, 2009

I've put together this simple code for an SWF with three roll over images (called: Training, Resources and Contact).When I roll over Training I would like the symbol Training_txt to tween its alpha to 1 (from 0) and tween its y axis to 220 (from 83).When I roll out of Training I would like to run the two tweens in reverse.
 
This works fine for each of the three roll over images, so long as each tween is allowed to fully execute before a new tween is started. The problem arises if i quickly move the mouse curser between the three roll over images before the previous tweens have finished executing.In this instance, the tweened objects start to behave erratically. They usually return to their original position as per the roll_out tween but then start jumping between y axis 200 and y axis 83 (without tweening - they just appear).

Code below -
 
stop();
import fl.transitions.Tween;
import fl.transitions.easing.*;[code]..........

View 1 Replies

Flex :: Stacked Bar Chart With Date As X-axis And Names As Y-axis?

Apr 13, 2012

I'm making a chart where the x-axis needs to have dates and y-axis names. The lenght of the bar is longer when the date is later. But I want to stack multiple bars on eachother. for example This is the code I have so far

<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[code].....

View 1 Replies

Flash :: Existing Engine For Bouncing Balls?

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

Actionscript 3 :: Random Bouncing Balls In Flash *Updated*?

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







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