ActionScript 3.0 :: How To Find Out Moving MovieClip Angle
Jan 21, 2011
How can we find out a moving movie clip's angle. I'm trying to make a shooting game in as3, I need to know the angle of the movieclip(bullet) when it gets hits on the wall. i.e., I have a movieclip named "ball", and which is moving with some speed and the coordinates are initially created by the gun's positions.
Code:
var angle:Number = gun.rotation - 1;
var bubbleX:Number = gun.x-130* Math.cos(angle * Math.PI / 180);
var bubbleY:Number = gun.y-130 * Math.sin(angle * Math.PI / 180);
var ball:MovingBall = new MovingBall();
ball.x = bubbleX;
I need to know, what is the angle of "ball" after it hitting the boundary areas..
View 8 Replies
Similar Posts:
Feb 19, 2005
I know some basic trig. but how do i find an angle from an anchor point and a moving point?
adjecent = _root.anchor._x-_root._xmouse;
opposite = _root.anchor._y-_root._ymouse;
hypotenuse = ((adjacent ^ 2)+(opposite ^ 2)) ^ 0.5;
View 2 Replies
Nov 27, 2009
I have a mc called the_ring which contains a little circle that spins around a figure. how can i find the location of this circle?
i could easily find the location of the movieclip by the_ring.x , but thats not what i was after, im after the location of the object inside of it.
View 3 Replies
May 22, 2010
I'm not a genius in geometry, I'd like to find a point in as3 with the radius and a angle but I don't remember the rule, I know this should be simple!
View 3 Replies
Apr 29, 2011
What I've done so far is using your mouse you (click & release) you shoot a ball off in that direction using radians. Now what I'd like to happen is when the ball hits the wall it bounces off in it's reflection angle. Eg. if the ball hits the right-hand-side wall travelling at in a radians of -0.65 it should bounce back in the radians of about -2.5
View 3 Replies
Apr 13, 2006
I am looking for a way to find a vector if I know one point and 1 angle. Like I have A(x, y) and a vector starting from A(x, y) with an angle. I would like to know the position on a point X (x, y) that can be anywhere on that vector. I only know the coordinates of A and the angle. Possible?? I guess it has to be a function...
View 5 Replies
Jun 25, 2006
I have a movieclip that I'd like to move from y 0 to y 500 along a -15 degree angle or any specified angle. How do I do that?
View 1 Replies
Jun 20, 2010
At the moment I am using two mini objects within the line to calculate the slope of the line I have.
I was wondering if there was some easy function within as3 to find the slope of a line that had been drawn out, if not... I suppose I have my own theories on how to do it, such as checking for hit tests in a circle until I find the line.
View 5 Replies
Feb 13, 2005
just need the code templet for moving an object in the direction it is angled at(the rotation).
View 3 Replies
Feb 13, 2005
just need the code templet for moving an object in the direction it is angled at(the rotation)
View 3 Replies
Nov 1, 2009
How to create motion blur which would be realistic at an angle? Applying simple blur filter looks fine if an object is moving vertically or horizontally but if its moving at an angle, its no good...
View 4 Replies
Oct 20, 2010
I need to move a movieclip dynamically over a path. The movieclip has a front which should remain pointing to front when moving along the path. So I need an angle at which the movieclip should be rotated regularly. This is something similar to the motion guide we have in Flash.
View 5 Replies
Sep 25, 2009
wat's the difference between finding a angle using Math.atan2(y,x) function and by finding using the movie clip's rotation (mc._rotation*Math.PI/180);
View 9 Replies
Feb 9, 2005
Ive made this rotation with AS. But Id like to make the bar to move from angle A to angle B smoothly.
How can I do this?
View 2 Replies
May 31, 2011
how can we rotate movieclip by some angle. I know the only one way to rotate it:
[Code]....
but my need is: suppose there is one center point, and movieclip should rotate some angle to right and left direction of that point.
View 4 Replies
Nov 3, 2009
I am building bouncing application, here is the document class:
Code:
package{
import flash.display.*;
import flash.events.*;
public class BasketBall extends Sprite{
private var IsMouseDown:Boolean = false;
[Code] .....
Now the problem is that the "ball" clip some times does not bounce properly and it is also not getting right angle.
View 3 Replies
Sep 21, 2010
so i have a movieclip with this script on it (this makes my movieclip rotates)
ActionScript Code:
onClipEvent(enterFrame){
angle = (Math.atan2(_root._ymouse-_y,_root._xmouse-_x)*180/Math.PI);
[Code]....
Now, i have (let's say) 30 frames inside this movieclip, and i wan't it to change is current frame depending on the angle of the mouse (example, if i point my mouse to the right, the mc goes to frame 30, if i point my mouse a little up, the mc goes to to frame 27, if i point my mouse all to the left the mc goes to frame 15... etc...)
Basically the movieclip should change it's frame depending on the mouse angle,
By the way, i don't really wan't the moviecliip to rotate (like it's doing now) i want it to change it's frame only...)
View 4 Replies
Aug 12, 2010
I'm attaching the file so that you guys can see that? pretty basic. My main problem is to find out how can the mouse check the mouse position on stage and make the coverflow animate and the movieclip change angle depending on the side, I have to animate only 5 itens, here?s the AS:
[Code]....
View 8 Replies
Feb 23, 2012
I have a function dragging movieClips on the stage which pass over other movieClips which I'd like to identify somehow.
Is there a "built-in" way to do this in AS3?
View 2 Replies
Mar 7, 2009
I have a main MovieClip in which I have several frame labels, each will eventually have different MovieClips associated with them. First time through I want to play an "intro" MovieClip, which I have placed on the stage at the begining of the main timeline, then at the end of the "intro" Clip, go to the first frame label and play that MovieClip.
The way I was going about it was placing this code in the last frame of the "intro" MovieClip:
Code:
MovieClip(parent).screen_mc.gotoAndPlay("home");
'screen_mc' is the instance name of the Main MovieClip.
[URL]
View 3 Replies
Nov 9, 2010
PHP Code:
public class Fruit extends MovieClip {
//something
}
var apple:Fruit = new Fruit ();
[code]...
Is there a way to find the class of apple without using (apple is Fruit)? Doing it that way takes an array and having to check it with each index of that array to see if it matches.
View 3 Replies
Dec 7, 2009
I am creating a flash file to display products.
Product details and images are stored in XML File.
What i am trying to create is something similar to banner on [URL]
The addition to this is that products will be scrolling right to left automatically if there is no interaction from user, and product at the center will remain highlighted.
I have created a long strip of Products cover with a mask, the long strip keeps moving to give a scrolling effect.
View 2 Replies
May 21, 2011
movieclips in flash have a Rectalge Zone . if we have a Circle shape and covert to movieclip , have a Rectagle Area.with empty area.
i want terminate this area when az drag any moveclip on my target movieclip. when i use hitTestObject do now work good.
View 1 Replies
Feb 3, 2009
Is there a way to find how many child of movieclip inside a movieclip .. in AS2 just like in as3 there is a property called numOfChildren or something like that?
View 2 Replies
Nov 26, 2008
Im currently making a game that has one of those old-skool Fallout maps (a world map where you click somewhere and the "you" marker moves there) that im trying to replicate.I already have the scripts ready for map interaction (using onhit here). But i was wondering if someone could help me with a script that works this way:
1. I have a movieclip (the character)
2. When i click somewhere on the map i want this movieclip to move there. Not instantly but moving over the screen to that point where you clicked.
3. I also want there to be passages that when the movieclip hit that movieclip (named hit for example) it stops dead and doesn't move (will be used on the map for mountains and such) and the player has to click somewhere else to move it that path (im assuming this will be something like onhit: hit - speed=0 something but im not a good scripter and it would had to be worked into the script.
4. ok this one is kinda optional but would be great! If it's possible to have it worked in the script that when the clip doesn't move (and is stationary on the map) the movieclip stays on frame 1 but when the movieclip is in motion (and moving across the screen) the movieclip is on frame 2 (and reverts to frame 1 when it's not moving anymore and so no)
View 15 Replies
Aug 9, 2010
I have a movieclip that I want to move down and up.I use a new tween using the Elastic. easeOut property to move the movieclip down over a duration of 2 seconds.But right after it moves down I need to move it right back up so it looks like a uniform animation.I used setInterval(reverse,2000) and reverse contains yoyo();This almost works.Since Elastic slows down the movement of the movieclip at the very end, there seems to be a pause between the movieclip moving down and the movieclip moving up.It does not give the impression that it is 1 tween, which is what I was going for.I tried to set the duration to less than 2 seconds, but then Elastic property is not 'stretchy'.It is too fast and comes to a halt, not elastic, and then the reverse (when the movieclip goes back up) is much faster than when the movieclip goes down.Is it possible to move the movieclip down AND up by using just 1 "new tween" function?
View 2 Replies
Oct 25, 2006
I have a movieclip that I want to move down and up. I use a new tween using the lastic.easeOut property to move the movieclip down over a duration of 2 seconds. But right after it moves down I need to move it right back up so it looks like a uniform animation. I used setInterval(reverse,2000) and reverse contains yoyo();This almost works. Since Elastic slows down the movement of the movieclip at the very end, there seems to be a pause between the movieclip moving down and the movieclip moving up. It does not give the impression that it is 1 tween, which is what I was going for. I tried to set the duration to less than 2 seconds, but then Elastic property is not 'stretchy'. It is too fast and comes to a halt,not elastic, and then the reverse (when the movieclip goes back up) is much faster than when the movieclip goes down. Is it possible to move the movieclip down AND up by using just 1 "new tween" function? I am out of ideas.
View 2 Replies
Jun 4, 2004
I want to rotate an object in AS because i think moving it manually is a waste of time
View 1 Replies
Nov 17, 2002
how to make the scroll/list menu in 2advanced's portfolio section, it can be found here [URL]
I kinda had a idea on how to make it , by using a mask and movie clip which holds the buttons, and then just use the up and down buttons to move the movie clip up and down, but dnt really know how to really do this.
basically want to know how to move a Movie clip up and down when a up or down button is pressed with restriction to how much i can move it up and down,
View 12 Replies
Jan 21, 2004
Is it possible to find out the number of frames of a movieClip using actionscript? Like in the main timeline have some actions in frame 1 to find out the number of frames in "content" movieClip?
View 2 Replies