Flash :: How To Make The Object Bounce Back
Feb 15, 2012for (var k:int = 0; k < 1; k++)
{
money = new Money;
[code].....
for (var k:int = 0; k < 1; k++)
{
money = new Money;
[code].....
I want to make a box come from off screen then bounce back and forth and then come settled down in the middle of the screen. It can be random bouning intervels or a set amount.
View 6 RepliesWhat I am trying to do is make an animated bounce back for a drag and drop game, so if the object is dropped in a location that doesn't satisfy the hitTest it bounces back to a pre set location. It seams simple but there is obviously something not working. Just so people know I am a total newby when it comes to coding in actionscript, so please be gentle as I probably won't understand what your talking about.
Anyway here is the code for the movie click which is being dragged.
[Code]...
i want to know how we can make back button in flash to go back to page same like browser back button.
View 1 RepliesIs there a way to reference the object and its other property base on the position of the target
[Code]...
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 Repliesurl...I was wondering if it's possible to setup an object to not just bounce off the walls, but other MCs that I put on the stage??I've included an example. I want the ball to be able to bounce off the ramp.You can "throw" the ball around the screen and it will bounce around.How can I get it to bounce off the slope without using too much CPU? Would hitTest() be too processor-intensive?
View 3 RepliesI'm trying to make a ball to bounce on something realistic.How can I make it work? It's impossible.
View 3 RepliesOkay, 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].....
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,
In the process of making a pinball game, i wanted to set up a system where a ball would bounce on an object, and eventually come to rest on it. Everything works fine, but eventually the ball just goes through it instead of coming to rest on top of it. I do not understand why this happens, and would like to know if there is anything i can do to fix this. The .fla is attatched.
View 4 Repliesive 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..
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].....
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 RepliesSo 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.
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 RepliesI 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 RepliesI'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]....
I managed to get the bounce working how do I make it continue to move forward after the collision?
View 5 RepliesI 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 RepliesI 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?
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.
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 RepliesI 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 RepliesI 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 RepliesI have a project (see attached) where I need to have the folders seem like they are floating in space, and I need the best way to make it so when you click on a back folder, it slides off the screen and come back in front of all the folders.
View 2 Repliesi 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!
I followed this tutorial to make a bouncing ball in flash. Its AS2 so it took me some time to make it work in AS3 Now I want to make the ball roll down a slope, fall and bounce when it hits the ground. I have attached my .fla.
View 1 Replieshow to make the ball move and bounce around the stage. and i also need help on the paddle that the ball bounces off of.
View 11 RepliesI'm working with a web service and am returning an array to a field (that I set the data type as an Array). The result thus far is "[object Object]". How can I get the array values back out as a string?
View 0 Replies