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
Similar Posts:
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
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
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
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
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
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
Feb 15, 2012
for (var k:int = 0; k < 1; k++)
{
money = new Money;
[code].....
View 1 Replies
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
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
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
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
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
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
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
Apr 1, 2010
I don't know much about flash.. I've created a MC with tomatoes falling.. when the MC repeats itself, which I want it to, looks too "rough". I am hoping to make the transition a little smoother.. I've read a little about mathematical random function, but it looks so complicated.Here is the flash: http:[url].....
View 4 Replies
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
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
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
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
Oct 28, 2009
I am having a problem with making 1 animation. I want to make a slowly appearing line. The scene is a pencil drawing a line. So as the pen end moves a line is slowly appearing, I couldn't get the technique on doing this?
View 5 Replies
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
Jul 5, 2009
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 Replies
Nov 11, 2011
How can I make a tween such as [code]...
View 2 Replies
May 31, 2005
I'm using the following code to spin a couple stars on the stage when the mouse rolls over them. Can't figure out how to make the stars slowly decrease in speed after the user rolls off though.
[Code]...
View 8 Replies
Sep 10, 2009
I have a movieclip, powerMeter, that I need to slowly expand until it's width is 80. I using
Code:powerMeter.width -= 80; to make it shrink, but I need a way to slowly make it scale back up.
View 3 Replies
Oct 29, 2003
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.
View 11 Replies
Jul 20, 2009
I am making a script so I can have a dynamic menu, this menu loads external buttons at random 8 at a time, and unloads and reloads every 25 seconds.[code]...
View 5 Replies
Feb 14, 2007
there an actionscript to make an image repeat for background purposes???I am used to using HTML and just letting the background repeat - is there a way to do this in flash? a code or something? and also, if there is... what are some attributes
View 2 Replies
Nov 30, 2011
We want to move the our player Upwards.("here's a working code")... But you gotta continue to click click click, or roll off roll on and the player will move, i promise the deal is, who the hell wants to do that??[code] What can we do, to continue this mouse down / click.. (doubtfully use click). .roll over maybe but we want that player to continue to move with out moves up 1 click again moves up 1.
View 8 Replies