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


Similar Posts:


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 2.0 :: Simple Vertical Shooting Game - Rebound Missile Always Spawns At Left Of The Stage?

Feb 6, 2011

Basically, I have a border(line) at the top of the stage so that whenever my ship's missile comes in contact with this line, it is removed and a rebound missile clip is attached.Here is the missile code:

Actionscript Code:[code].....The problem is that the rebound missile always spawns at left of the stage, not wherever the ship missile was removed.I'm not sure if I should attach the fla, action script files, swf etc. to the thread. Also, my flash version is CS5.

View 3 Replies

ActionScript 2.0 :: Make The Bar To Move From Angle A To Angle B Smoothly?

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

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

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 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

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 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 :: 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 :: 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

ActionScript 2.0 :: Equation Generate To Graph \ Show A Slope Graph?

Jan 26, 2010

School Project with the following actionscript in Flash 8, I want to show a slope graph? What code to add to make slope graph work?

/*var orig_x:Number;
var orig_y:Number;
orig_x = (plane_mc._x)+(plane_mc._width/2);

[code].....

View 0 Replies

Professional :: Can More Other Angle That X And Y

May 17, 2011

I'm using Flash CS4 Pro.In Motion Editor, the way that the blur works, it allows you to blur an object on X and/or Y axis.That means you blur horizontaly or/and verticaly.I would like to make a blur motion at another angle, by example 30 degree.

View 1 Replies

ActionScript 3.0 :: Getting Mouse Angle?

Jul 1, 2011

i have a movie clip that follows my mouse to create a fading line.the thing is that i want that movie clip to change its angle according to the mouse movement.Right now the mocie clip is kind of changing its orientation but it's also gettin cray and is not fluent.heres the code of the part that draws the mouse

private function drawMouseLine(e:MouseEvent):void[code].........

View 3 Replies

Javascript :: Get Angle From Matrix?

Feb 21, 2011

I know a matrix [x scale, y skew, x skew, y scale, trans x, trans y], and would like to get the angle in degrees.

View 2 Replies

ActionScript 3.0 :: Get The Angle Between Two Points?

Oct 30, 2010

say I have two points: 0,0 & 1,-1If i were to get the angle between these, it should return 45.But the function i have created below returns -45, and If i give it the points 0,0 & 1,1 it returns 45.

ActionScript Code:
function point_direction(x1:Number, y1:Number, x2:Number, y2:Number):Number
{

[code].....

View 6 Replies

ActionScript 3.0 :: Carousel - How To Get Rid Of Angle

Sep 1, 2009

I have a carousel built and it works fine, but there is an angle on it that I want to get rid of. When the images move along the carousel, I want them to always stay the same on the X axis. Here is the code, I have tried mangling it in every possible combination, but it is outside my AS3 knowledge on how to get the angle changed.

import mx.utils.Delegate;
var numOfItems:Number;
var radiusX:Number = 1150;
var radiusY:Number = 50;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 6;
var speed:Number = 0.002;
[Code] .....

View 1 Replies

ActionScript 2.0 :: Get Angle Of Mouse?

Apr 18, 2009

how to get angle of mouse its very simple.use this Script (copy and past in your file). A sample file which runs only on CS4 is attached.

//Start............................................. .................................................. .................
// Make a line (o-----------------------) and take its left side as center named 'mcArrow'
mcArrow._x = mcArrow._y =200;

[code]....

View 1 Replies

ActionScript 3.0 :: Constrain Angle To Between -180 And 180?

Oct 27, 2009

I'm at a bit of a coders block, and I'm sure it's quite simple. I tried using the following:Code:((angle-180)%360) + 180But for angles < 180 degrees, it works just fine, but after that it get's a little funny. I know why it's doing that, I'm just looking for a way to fix it.

View 2 Replies

ActionScript 3.0 :: Input Text Box On An Angle?

Feb 5, 2009

take that same input text box and rotate it on an angle. preview. my type cursor shows up over it but it won't let me type anything int he box (or it if it typing, it's not showing up... which is half of the point).

View 5 Replies

Actionscript 3 :: Get Opposite Radian Angle?

May 28, 2010

I am trying to retrieve the opposite radian angle after I have retrieve a radian angle from another calculation. This is using AS3

View 2 Replies

Actionscript 3 :: Limit Angle To Segment

Jun 24, 2010

I need to limit an angle so it fits into a segment. I have drawn and links to a diagram below to better describe what I am after. I am trying to calculate this for a computer program, where I have an angle (slope), and a point (the mouse pointer). The distance does not matter to me, just the angles. If the point is within b1 (green area) then that's fine. But if the point is within b2 or b3 (red or orange) areas, then the angle should snap back to the limit of the green area (along the line s).

The main problem I am having in figuring this out, is snapping the angle to the correct side e.g. If the point is in the red area, then the angle should snap to the angle s on the red side and vice versa. I am also having trouble because s could be any angle, so I am being tripped up because I can't just do something like this:

[Code]...

View 3 Replies

Javascript :: 3D Rotation With Axis & Angle?

Sep 28, 2010

I know 3D rotation is well documented on SO and many other sites, but despite reading countless explanations I still haven't figured out where I'm going wrong. My background is in art and design, not math and programming, and I'm never really certain if my angle of attack (no pun intended) is the right one. Rather than paste a patchwork of my dismal code, I'm including an image describing my problem. What I'd really like is a step-by-step worded breakdown of how to solve it. Pseudo code is useful, but I will learn more if someone will just aim me in the right direction or point out common pitfalls.

[Code]...

View 3 Replies

Flex :: Position Text On An Angle?

Oct 4, 2010

I'd like my text to be positioned on a 45 degree angle. Is there an easy way to do that? (In the worst case, I could always make a png out of the text). But, I hope that there's away to do it in Flex. I don't need an animated effect.

var angleText:Text= new Text;
angleText:Text.text = "My text is angled!"
angleText:Text.x= 200;
angleText:Text.y= 300;

View 3 Replies

Flash :: Calculate The Angle (BAC) In Degree?

Feb 25, 2012

I have this code :

var a:Apoint = new Apoint();
a.x =0; a.y=200;
addChild(a);
var b:Bpoint = new Bpoint();
b.x =275; b.y=100;

[Code]...

View 1 Replies

ActionScript 3.0 :: Angle / Distance To X Y Values?

Aug 15, 2009

I have a method that takes a "distance" and "angle" parameter. How can I take the angle parameter to get x and y values, and incorporate the distance into that?

I am assuming that I would have to do something with a right angle triangle.

View 8 Replies

ActionScript 3.0 :: How To Change Angle Of BevelFilter

Aug 29, 2009

How can change the angle of a premade BevelFilter with AS3.0? (made in the Flash interface, not generated by ActionScript). I tried doing:
ActionScript Code:
myObj.filters[0].angle = 225;
But it doesn't seem to change not even when I trace the value out. When I trace myObj.filters[0] I get returned [object BevelFilter], meaning that the filter does exist.

View 0 Replies

ActionScript 3.0 :: How To Move Object In An Angle

Dec 8, 2009

i am following a tutorial from a book, Learning Actionscript 3.0, A Beginners Guide, where it discusses how to move an object in an agle. I have managed to get the app working fine, but i'm tryin to test it out in different angles but everytime i change it seems to go into the same angle.[code]Can somebody tell me why for everytime i changed the value of the degrees, it does not updat the movement of the ball please

View 3 Replies

ActionScript 3.0 :: Drawing Shapes At An Angle?

Dec 29, 2009

I have a code, that draws a horizontal line, then it turns into a slope, and at the end of the slope it draws a circle. Here's a code:

Code:
var xspeed:Number = 1; // defines increments for x of slope
var yspeed:Number = 2; // defines increments for y of slope
var hspeed:Number = 5; // horizontal line increments

[Code]....

Create document 800x700 and put this code into main timeline. Now test movie As you can see, everything works great. But there is a problem. The circle is being drawn at 0 degree angle. But I want the circle to match the angle of the slope, so it looks like the slope and the circle are both at the same angle.

View 1 Replies







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