ActionScript 2.0 :: Rotating MovieClip On Slope?

Apr 21, 2007

How can I rotate a movieclip so that when I move it, it will rotate slightly depending on the angle of the ground. The only thing I can relate this too is the old school sonic games. How would I find the curve of the ground and apply it the moving character?

View 8 Replies


Similar Posts:


ActionScript 2.0 :: MX Jumping On A Slope?

Nov 19, 2010

I have this rather cool code for a _mc on a slope. The only problem I am having is making the sprite.mc change states/animation when the sprite.mc is jumping.here's the code I have:

onClipEvent(load){
speed = 5;
gravity = 0;
r = _height/2; //radius

[code]....

View 1 Replies

IDE :: Rotating A MovieClip

May 12, 2010

I have a circular diagram with approximately 8 icons around the outter part of the circle. These points are all buttons. When Clicked, I want the diagram and icons to animate round to the top point (360 or 0 degrees). Then, when another icon is clicked they will all move round so that one is at the top.It would be a great bonus to have a slick easing in motion too but not essential - just a 'nice to have'.I have looked over forums and responses and there is quite a bit of info on this but I'm finding it difficult to apply it to this particular project.

View 2 Replies

ActionScript 2.0 :: Rebound Angle On Slope?

Jan 22, 2011

I have the xspeed and yspeed of a round ball, xspeed is distance ball moves to the right each frame and yspeed distance ball moves down each frame.I have 3 different gradients of slopes, one is at 15 degrees off the horizontal.How can I calculate the xspeed and yspeed of the ball after a collision with, for instance, the 15 degree slope.

View 2 Replies

ActionScript 3.0 :: Drawing Slope Of A Line?

Jan 27, 2011

I'm trying to create a simple graph showing the stock trends for the past few days. In the x axis I have the dates and in the y axis I have the stock value. I have to do this dynamically and I think I can figure it out, but I need help with something else: I need to be able to (dynamically) draw the slope of the line as the user clicks on a point... something like in www_calculusapplets_com/twicediff.html except that instead of having the slider the user will click on the actual line.

View 6 Replies

ActionScript 3.0 :: Convert Slope To Degrees?

Jul 7, 2011

I'm having trouble with this mainly because Flash's Math.atan() doesn't give the same results as my TI-83's tan^-1 function.

If I have a line with a positive rise and run for the slope and use tan^-1( (the slope) ) on my calculator, I get a value between 0 and 90, with 0 being a horizontal line and 90 a vertical line. A negative numerator with a negative denominator for the slope puts it in quadrant 4 where tan^-1(slope) gives 0 to -90 values, again with 0 being horizontal and -90 being vertical.

Putting the slope of the blue line into tan^-1() would give a value of about 80 degrees, while the red line would calculate to about -50 degrees. The rotation property Flash uses rotates objects clockwise and can range from 0-360. Using the -90 to 90 values and figuring out if the rise and run of the slope are positive or negative, I can determine which quadrant the line is in and calculate the degrees.

However, this so far is not possible for me because Math.atan() gives odd results.

A practical application for this knowledge would be a player in a game throwing spears from (0,0) to the mouse x,y. The slope would take care of the trajectory of the spears, however if your spear sprite is a spear flat and facing toward the right, you need to rotate it appropriately from 0-360.

View 1 Replies

ActionScript 3.0 :: Slope Detection In Platformer

Jun 15, 2010

I have an art based platformer with a movie clip that is basically a triangle shaped object that serves as the slope.My problem is in the collision detection with the slope. Here's the code that i currently have - [code]This basically places the rectangle shape that serves as the main player (_rec) along the slope and increments its y position based on it's current x position. The reg point of the slope is on the bottom left.The problem is that this code comes into effect even if _rec is jumping over the triangle because of the square shaped hitbox of the slope. Also, for the same reason, I cannot jump while on the slope itself.I know of a way to rotate the character based on the incline in the ground but I don't really like that idea. The character should stay vertical at all times. I really don't want to do a tile based version as I have a lot of art already designed, it's only the ground objects that are basic shapes.

View 1 Replies

ActionScript 2.0 :: CS3 Rotating Movieclip To Another Movieclip?

Apr 1, 2010

im using CS3, AS 2.0

how do you rotate the position of one MC to another. for example a triangle, i have one mc that rotates to face the mouse position but i want another mc to rotate towards the player

View 4 Replies

ActionScript 3.0 :: Rotating A MovieClip?

Apr 16, 2010

I'm trying to rotate a movieClip from it's original position, to a random anglehere's what I have:

function getRandomNumber(min:Number, max:Number):uint{  var randomNumber:Number=Math.round(Math.random()*(max-min)+min); return randomNumber;}
particles.rotate(angle:getRandomNumber(0,180));

[code]........

View 2 Replies

ActionScript 3.0 :: Rotating A Movieclip Using The Mouse?

Mar 30, 2009

I have been trying to convert this effect into AS3 but have been having majour issues : rotate clip

I have an object (class) with a handle, when dragged I would like the clip to rotate with the mouse (much like rotating an object in photoshop). I have put my code into an ENTER_FRAME event, and have been using a matrix object to do my rotation (is there an easier way?)

Code:
private function rotateClip(e:Event)
{
myMatrix.rotate((Math.floor(180*Math.atan2(mouseX,mouseY)/Math.PI)+90));

[Code].....

was my attempt at converting the code from the example link. I've also tried various other methods using trig to no avail.

View 1 Replies

ActionScript 1/2 :: Rotating A Movieclip In A Given X,y Point?

Dec 8, 2010

how can I make the green movieclip rotate in the point that the claw has catch it. To give an impression of physics. Here´s the image, to give you an idea:
 
The point (x,y) that the claw catches the colored movieclips below is not unique it can be any number. As long as the claw catches the colored movieclip.

View 13 Replies

ActionScript 2.0 :: Rotating Movieclip Around Its Middle?

Jan 7, 2011

How do I make an mc constantly rotate? I know this must be simple but i dont know how to do it. I just want it to rotate around its middle. How would i do this?

View 1 Replies

ActionScript 2.0 :: Rotating MovieClip From 0 To 180 Degrees?

Jan 23, 2007

I've created some code that rotates an arrow up or down when the user clicks on it, depending on whether the timeline is on frame 1 or 5. The problem I am encountering is that rather than rotating visually, it just flips to the correct degree (in this case, 0 or 180).

Code:
function turndown():Void{
for(i=0; i<16; i++){
this.upDownMC._rotation += 11.25;
}} function turnup():Void{
[Code] ......

View 5 Replies

ActionScript 3.0 :: Find Slope / Angle Of A Drawn Line?

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

ActionScript 3.0 :: Flash Finding Best Fit Slope Of A Bitmap Surface

Jan 24, 2012

I was wondering if anyone knows of a way to isolate the pixels that are adjacent to a certain color pixel in a BitmapData. For example, if there was a BitmapData that looked something like this:[code]I was wondering if there was a proven and efficient way of doing this, because I am trying to make a collision engine of sorts that can give me the collision normal of the best fit slope of a given bitmap image. In the scenario of the last example, the slope would be 1/1, or -45 degrees. The way I have it now, I am isolating the adjacent pixels by blurring the entire image, looping through all of the pixels, and storing the gray ones in an array. from there I can determine the best fit slope of the surface of the image. The only thing is that this seems like a lot of work for the CPU. Is there a better way to isolate the black pixels adjacent to white ones than blurring the image and looping through every pixel?

View 12 Replies

ActionScript 3.0 :: Rotating A MovieClip Around Its Center Using A Handle?

Nov 4, 2010

a movieClip that contains a polygon and some circles at the angles of the polygon. I want to use the circles as rotation handles.Now the code below works but it terribly, terribly slow.I've seen a couple of other examples of rotation using the mouse position, but I want the polygon to rotate via the handle; I think that means the angle of rotation needs to be updated each time the mouse moves.Is there a cleaner/more efficient way to do this?Also, this works only for one direction right now no matter the x/y direction you move the mouse.

public function mouseDownRotate(event:MouseEvent):void {
// get the global x and y of the dragged piece (offset so it looks like it's rotating around the polygon's center

[code]......

View 6 Replies

Flex :: Rotating Movieclip Back To Square?

Jul 20, 2010

I have a movieclip that I am using greensocks transformManager with so the user can rotate, skew, and scale the clip. This works fine, but I am trying to add a crop tool. If the image is rotated, when I send the image to the crop tool it measures the height of the image by the bounds of the rotated image, not the actual height of the image if it were square (re: not rotated).

So, what I tried to do what, after sending it to the crop tool, rotate it back to 0 before getting the bounds using this code:

[Code]....

I don't understand the math here. Shouldn't it just rotate 3rads in the positive direction to equal it out? How would I return it to 0;

View 1 Replies

Actionscript 3 :: Track A Point On Rotating MovieClip?

Feb 14, 2012

I have a MovieClip, that is representing a character in my game. Id like to "create bullets" shooting out from the tip of my characters gun. Problem is that when my character turns around, also the point rotates around the MovieClips pivot.

Is it possible to anyhow easily track this point, so that I could dynamically create new objects at the same location.

I tried to add a new MC as a child to my character, with the initial position at the guntip. In some systems child-objects "follow" their parents around, but it didnt seem to work here.

Is there any other "native" way of doing this, or do I just have to have a Polar-coordinates representation of the point relative to character-MovieClips origin, and add the MC rotation to theta, so that I can calculate the X and Y coordinates?

View 2 Replies

ActionScript 2.0 :: Collision Detection Within Rotating MovieClip

Feb 15, 2007

I am working on a snowboarding game, And have two points of collision detection on the board:
x-----xOne at the Front of the riders boardOne at the Back of the riders boardThese two points of collision are placed within the rider.movieClip, and not on the _root timeline, as the rider movieclip can rotate etc as it rides through different gradients of slopes. I have used a largely basic method to obtain the X,Y positions of each collision point, using the following method:

Code:
var backX:Number = _root.rider._x+_root.rider.backDetection._x;
var backY:Number = _root.rider._y+_root.rider.backDetection._y;
(The same for the frontX and frontY) As you can see, it simply adds the offset of the detection points positions from the riders x, y therefore when the rider movieclip is rotated during gameplay, the rotation is not accounted for and it still searches for collision in exactly the same positions.

I am using this for collision checking:
Code:
this.hitTest(backX, backY, true)
Which is placed on the ground movieclip (what the snowboarder is riding on). Any better way of doing such collision checking, or how to account for rotation? is localToGlobal() the answer?

View 1 Replies

ActionScript 3.0 :: Rotating MovieClip To Point At Mouse

Jul 4, 2007

I am trying to make a line point to wherever the cursor is when I stumbled upon the Math.atan2(); function. It appeared that i would put
line.rotation = Math.atan2(1,1);
to get 45 degrees or pi/4, but I was wrong. It barely moved the movieclip at all. So what I'm trying to do is to get this movie clip to rotate along with the mouse so the line is always pointing at the cursor. Also, how would you get movieclip to move along the line created by the line of these two points?

View 9 Replies

ActionScript 2.0 :: Rotating MovieClip Towards Mouse Position

Feb 12, 2005

Any way to rotate a movieclip to face the mouse location?

View 1 Replies

ActionScript 3.0 :: How To Make Ball Roll Down Slope / Fall And Bounce

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

Actionscript 3 :: Movieclip Stops Rotating After It's Box2D Body

Nov 30, 2011

I have made a Car Game using Box2D [in Flash] and I have one remaining bug, which I cannot fix. I added graphics and put them on top of the Box2D body. Everything went as good as expected, but after X rotations the movie clips for the car-wheels, stop spinning. I do something like this wheelSprite.rotation = wheelBody.GetAngle() * 180 / Math.PI. I ran a separate program and I saw that, if you do X.rotation += variable and you increase the variable every frame, after ~30 000 (value of variable) the MovieClip stops rotating, so I reset it to 0 after ~28 000. What do I do? The wheelBody.GetAngle()

View 2 Replies

ActionScript 2.0 :: Drag And Drop Movieclip With Rotating Control?

Oct 25, 2009

I want to make a drag and drop movie clip with rotating control in 360 degrees.I made a movie clip with 30 frames with a button in centre which can rotate the object in 360 degrees.At this stage it is functioning.when i tried to add the drag and drop action to the movie,the button for rotation is not working.

View 0 Replies

ActionScript 2.0 :: Coded Draggable Rotating Movieclip Effect?

Mar 18, 2010

My client has a simple shape that they want the user to be able to animate, i.e. it looks like a single square on the stage, but when you grab it and drag, a load of squares appear and fan out from the corner of the first. I was thinking, I can easily achieve the first part of this by attaching, say 20 movieclips of my square to the stage, but I'm not sure how to approach the back/forth draggable aspect of this.

View 1 Replies

ActionScript 2.0 :: Rotating A Movieclip Whilst It Moves Along A Guide?

Jul 25, 2010

i am trying to rotate a graphic that is following a guide path,

this.leaf._rotation +=2;

this successfully rotates the object but it stops moving along the path,
if i dont put this code in then it moves along the path fine,

how to get them both to work at the same time?

View 3 Replies

ActionScript 2.0 :: How To Make Rotating MovieClip Fade Out / In At Specific Frame

Apr 1, 2009

I've created a movieclip that is supposed to begin the movie with a rotation (it's a globe) and at a specific frame it should beginning to fade out. I've inserted the folowing code to the rotation and for this action it is working perfectly
Code:
onClipEvent (enterFrame) {
i = getProperty(this,_rotation);
setProperty(this,_rotation,i + 0.5);
}
But, when I try to insert any other line for the _alpha, a sintaxe error occurs and the rotation doesnt works.

View 1 Replies

ActionScript 3.0 :: Custom Class Registration - Rotating At 0 - 0 Axis And Not At The Centre Of The MovieClip

Apr 3, 2009

I posted a question regarding how to make a ladybug move around the screen and I managed to make a class that loaded a ladybug png then using a timer moves the bug around the screen...
but I have a huge problem...this has been bugging me all day and cannot find a solution...
The ladybug moves around the screen but rotates towards the moving direction before moving. The problem is that the ladybug is rotating at 0,0 axis and not at the centre of the movieClip. Is there a way to offset the registration point so that the ladybug rotates centred?

[Code]...

View 1 Replies

ActionScript 2.0 :: Rotating Menu With Non-Rotating Labels?

Nov 1, 2005

I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?

View 8 Replies

Actionscript 3 :: Drawing An Arrow At The End Point Of The Line Using Line Slope?

Jan 9, 2012

I am developing a white board application which allows the user to draw line with arrow head (some like Microsoft Word line with arrow feature). I am using graphics property along with lineTo() method to draw a line. Now i have to draw a angular arrow on the last point of line. I am drawing the arrow by connecting the points around last points. As 360 line can pass through this point and each line can have a different angle of arrow.

View 1 Replies







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