ActionScript 2.0 :: HitTest - Bouncing 2 MovieClips Backwards 10 Pixels
Nov 23, 2003
I have 2 Movieclips, box and car, and I want them to bounce backwards 10 pixels when they hit. I have a little understanding of hit test but do not know how to make something happen when hit test occurs. And it would be great if you could make the movieclips "move" back 10 pixels instead of automatically jumping 10 pixels back.
View 1 Replies
Similar Posts:
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
Jun 17, 2009
Is there anyway I can do a hittest that ignores transparent pixels? If so how would I do it.
View 2 Replies
Sep 16, 2010
Im having multiple movieclips moving randomly and bouncing of the stage border, however, my problem is, first of all that the movieclips get half their body into the border on the right and top, and on the left and bottom the movieclip stops before the border. My other problem is that the movieclips have a tendency to get stuck in the border and just bounce rapidly along the border side. Im gonna asume that i only need to show you the code which the bounce back at border is created not to make the code to long (so hopefully im right):
[Code]...
View 1 Replies
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
Jan 26, 2005
Usually i know you would name each dupicalted movieclip sumthing like "movieclipname"+nextnumber But i was in this case hoping i could name em all "bullet" for the simplicity of hittesting using bullet1.duplicateMovieClip("bullet1", this.getNextHighestDepth(), {_x:bx, _y:by, xs:Xmov, ys:Ymov});
to duplicate
and
if(this.hitTest(_parent.bullet1)){ // is an onEnterFrame
trace("wuuuuuuuuuu");
to c if anything is happening
nothing however happens, i am not ceeing the trace message.. Can i not have many movieclips named the same, or is there somethign else i need to consider
View 9 Replies
Jan 15, 2009
I am designing a flash game and I am having a bit of trouble with the Actionscripting, I wondered if you might be able to help me? I will try and explain how the game should function and I attach a JPG that shows the rough layout as well, hopefully from that you may be kind enough to point me in the right direction.
How it should function The idea is you have a glass that you control, left and right keyboard arrows control left and right movements and it only moves on the _x axis and the _y axis always stays at it's current value, this works fine and I have managed to add actionscript to the glass movieclip to do this, the movement also has gravity and friction which means the glass slides on a little even when you move to go the other way.
Using the Glass you need to collect falling object movieclips, there are two types, good and bad. When you catch the good it adds to your score and when you catch the bad it deducts from your score.
The falling objects need to be random and I have successfully managed to get 1 movieclip to fall by using actionscript code and also I have managed to set the _x position as random each time , the actionscript to do this has been applied to the falling object.
[Code]...
View 3 Replies
Jan 26, 2005
Im making a game in which you controll a turret and it spews out bullets like mad..Usually i know you would name each dupicalted movieclip sumthing like"movieclipname"+nextnumberBut i was in this case hoping i could name em all "bullet" for the simplicity of hittesting
using
bullet1.duplicateMovieClip("bullet1", this.getNextHighestDepth(), {_x:bx, _y:by, xs:Xmov, ys:Ymov});to duplicate
and
[code].....
View 9 Replies
Mar 15, 2009
I'm trying to hitTest two duplicate movies clips. One is a bullet and the other is an enemy. I have them properly duplicating, but I cannot figure out how to detect a collision between the two. I've trying everything I can think of, and so far I've only been able to get the hitTest working between the original enemy and the bullet duplicates.Here is the code for duplicating the enemy:
Code:
bb++;
duplicateMovieClip(_root.target, "t"+bb, bb);
[code].....
View 2 Replies
Jan 3, 2011
I'm creating a platform game, and I have those boxes which needs hitTests on all sides - including the bottom.I want my hit areas to have the same instance names. With that I mean, that I want only one instance name for all the bottom hits, one instance name for alle right hits - and so on. If it's possible. 'Cause else there will be so much actionScript code to write.I've been trying to simply make a normal hitTest on for example hitGround, and then place two movieclips with the instance name hitGround, but the hitTest function only works on the last added movieclip with that instance name.I have also been trying to look up some for each in-arrays, but I don't really get the meaning of how to use them.
View 2 Replies
May 3, 2010
Code:
if(_root.selmovie.hitTest(this._parent)){
_root.hit.text="it worked";
}
Why doesnt this work? I want to avoid naming all of the movieclips that this hittest is to apply to but this._parent isnt working...
View 4 Replies
May 3, 2009
I have a character, he stays in the center whilst the surroundings move instead (scrolling). There is a block and when you walk into it, I need it so you cannot walk through it or get stuck in it. Here is my code below but, its very buggy, this is obviously been done before and may be simple, once I learn it I wont need to ask again. Iv tried other things but they dont work.[code]
View 6 Replies
Jul 31, 2009
I've got some flash 2.0 code that is supposed to add 100 points after a hitTest.
Code:
function onEnterFrame(){
connectA();
var strandID:Number
function connectA(){
for (var i = 0; i < 100; i++) {
if (this.hitTest(_root["A_" + i])) {
this.strandID = i;
_root.total = _root.total + 100;
}}
The problem is that it adds 100 points 70 times per second (the frame rate). It's supposed to add 100 points and stop. Here's a little more info: the hitTest makes two movie clips move across the screen together. Maybe because they're constantly hitting as they move, I don't know.
View 6 Replies
Jun 8, 2006
i searched everywhere, i was not able to find a solutionmy xml menu implementation use a "main" Menu class. This class parse the xml file and create an aeeay of MenuItem class.MenuItem costructor is (stripped down version) something like this:Code:function MenuItem(name: String, url: String, parent_mc: MovieClip)parent_mc is a reference to the "container" MovieClip for Items (generally an emptymovieclip made by Menu class)
View 3 Replies
Dec 12, 2002
Does anyone know how to use hitTest with two movieclips so that it would detectthe collision of the visible part of the MC, not the **** bounding box???
View 2 Replies
Apr 28, 2007
[Code]...
NOTE: The following text is my problem and observations, if you afraid to read it all, my problem is easily guessable within the code go ahead and crack at it without my explanation :-p I'm having some trouble with using hitTest(); with movieclips within arrays. I wanted to build a function that checks the hitTest of Movieclips in arrays because the array is dynamic and it would run more efficient and faster this way.
As you may notice it doesn't check just the movieClip in the array, but a movieclip 2 scopes within it. I feel that this is my problem. I noticed in my debugger that that mc doesn't show up, but i put an onLoad event on it to trace its existence when loaded and it shows up fine. I wonder what I'm doing wrong.
View 2 Replies
Mar 24, 2012
so instead of the pixels being dissolved, the pixels being added? :
ActionScript Code:
var Anim:TransitionManager = new TransitionManager(blackbox);
Anim.startTransition({type:PixelDissolve, direction:Transition.OUT, duration:1, easing:None.easeOut, xSections:35, ySections:35});
basically what i would like is the end point to be the start point and the start point the end point.
View 2 Replies
Jun 17, 2009
I have a swf file that loads into my main movie, and within that swf there is a masked image that i would like to scale using zoom in and out buttons and also by using a slider bar.However i cant find any tutorials that will allow me to combine the two.I have used the following code for the buttons. Which seems to work ok but i would like it to be a little smoother. (using speed or some sort of easing??)
ActionScript Code:
zoomPlus.onRelease = function(zoomIn) {
if (test_shirt.shirt._xscale == 400 && test_shirt.shirt._yscale == 400) {[code]....
but for this code it keeps shrinking my initial object down to 10 pixels by 10 pixels..
View 0 Replies
Nov 18, 2009
I have a movie clip called column1_mc. when I click a button I need to move the movie clip in incremental moves consisting of 30 pixels.
column1_mc._y = 30;
Does not work because that is giving a _y coordinate.For example.I need to make the movie clip jump to _y 300 but make 10x30 pixel incremental jumps. Moving 10 times 30 pixel jumps.
View 1 Replies
Jan 15, 2009
i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).
View 1 Replies
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
Feb 8, 2010
i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
[code].....
View 1 Replies
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
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
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
Nov 2, 2004
I followed the tutorial about gravity, with bouncing, and I wanted to figure out how to test when it has stopped bouncing.
What I am trying to get at is say I had the objet bounce from a point, then when it has stopped bouncing, move left or right. Think of a person dropped from a plane with a parachute. He has to wait until he is firmly on the ground before he can start moving...thats what I want to do.
View 1 Replies
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
Jan 1, 2007
I've been trying to recreate the yugop examplewhere the balls seem to bounce off each otherbut the difference is, they can also rest on top of each other.click to add more balls.
Code:
main.fla
var ballcount:Number=1;
[code]....
View 3 Replies
Sep 19, 2009
I have an image and I want it to have a reflection and to apply an effect onMouseOver so that image bounces (like a rubber ball) until it stops.I found this example (http:url]....)that does exactly what i want (except I want it to bounce just one time per mouse over), but this is for Flex and I cant manage to translate it to Flash.
View 2 Replies
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