ActionScript 2.0 :: Any Way To Calculate Target Speed Value?
Jan 25, 2007
I have some code that works out a target speed based on how far right of the screen ur mouse is as follows:
Code:
if(this._xmouse > value1 && this._xmouse < value2){
//set targetSpeed depending on how much greater than value1 it is
targetSpeed = this._xmouse-value1;
}
Is there an elegant mathematical way to calculate the targetSpeed value so that - it increases as xmouse gets greater, until xmouse is at the value that is the midpoint of value1 and value2, from when on, targetSpeed decreases as _xmouse gets closer to value2. So if value1 = 500, and value2 = 600, then as xmouse goes over 500, targetSpeed will increase 0, 1, 2, 3, 4 - up to 50. then as xmouse goes over 550 targetSpeed will decrease until xmouse is at 600, by then targetSpeed will be back to 0.
View 9 Replies
Similar Posts:
Dec 5, 2009
How would you calculate or determine the mouse speed on the stage? What i am trying to do is this:
You have a custom cursor which shows a plus sign when you very suddenly and fast change the direction of the mouse to the right. When you do the same to the left, the cursor changes to the minus sign.
However, if you steadily move the mouse from left to right while the mouse cursor is showing the minus sign, the mouse cursor stays the same, only on very fast change of direction the cursor changes?
View 9 Replies
Sep 29, 2011
I'm trying to calculate the time it will take a movieclip in Flash to decelerate to zero. The starting speed will vary, but for purpose of example lets say[code]...
View 1 Replies
Feb 1, 2010
How can I calculate the angle of a 3d object based on the mouse speed?I want to change the rotationZ state based on the mouse position.
View 0 Replies
May 4, 2011
How can I calculate the next position of a "enemy" if know the positions x, y, rotation and speed?
View 1 Replies
Mar 8, 2005
I'm developing a game atm, and I need some help on the mathematics/coding of colliding circles (and their change in x/y speed). What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision
If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled. Does anyone here have any insight, links or tips on how I can du this?
View 6 Replies
Mar 8, 2005
What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision.If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled.
View 6 Replies
Jul 1, 2011
I as this working in AS2 and need to update to AS3...shows that AS3 doesn't like sloppy coding. Here's what I need: I pull data from an XML and that works when I put the data into a dynamic text box. However, I can't seem to get the date of birth into a variable. I have some code that calcs age in years but uses a string literal that I thought I could just replace with a variable from my XML...ain't a workin'. Here's the code I have:
ActionScript Code:
import flash.display.*;
import flash.text.*;
import flash.events.*;
[Code]......
View 0 Replies
Aug 7, 2010
I want to add an animated .gif file to my movie. So I created a new symbol and then imported the .gif file to the stage. This created the symbol containing the animated .gif.I dragged the symbol onto the scene where I want it. However, the animation seems to play at a different speed (fps) than normal. So I changed the fps of the symbol (at bottom of Timeline where it says "fps"). But for some reason this changes the fps of the rest of the entire movie.
View 3 Replies
Dec 13, 2009
I'm tweening a movieclip from startX to finishX. The value of startX varies but finishX is a constant. But as the startX increases in value the animation appears to be quicker. How do I adjust the speed of the tween to ensure a consistant speed regardless of the value of startX?
View 1 Replies
Jul 24, 2009
is there anyway to change a songs playback speed depending on a speed variable. heres the kicker tho im limited to using only as2.
View 2 Replies
Mar 23, 2010
I have a movie clip on my scene which has a speed applied to it making it move across the screen. This is duplicated when it reaches the other end of the screen.On my scene I have some action script which is acting as a timer. After a set time I want it to increase the speed of the movie clips, making the game become "harder". I seem to be able to manipulate the alpha of my movie clips but can't seem to trigger the speed increase.If i use a setInterval it seems to trigger the speed increase but it does it each time the movie clip is duplicated (so the delay resets, it does not change once and apply throughout)However, where I am changing the alpha I cannot seem to change the speed.
View 2 Replies
Sep 20, 2009
How can i detect mouse speed with AS 3.0, and then put speed limit? Also can i use speed var for anything else? *sorry for my bad English, i live in non-english-speaking country*
View 9 Replies
Jul 16, 2005
How can I detect a PC speed our cpu speed with actionscript?
View 1 Replies
Sep 29, 2003
On the attached exercise, is it possible to stop further items being dragged onto a target when the target box is full?
View 1 Replies
Nov 28, 2011
What is the difference between target and currenttarget in flex?What is the difference between Target and Current Target in Flex especially in mouse events.
View 2 Replies
Aug 30, 2010
qi have a movieclip which is added to the stage:
var profileholder:profileHolder=new profileHolder ;
inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:
//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}
this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()
i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}
and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Mar 14, 2005
i don't know why this isn't working.i got a button. and when it's pressed, i need it to go and play a frame in a movie clip. i'll test it and then when i click on it, i get this:
Target not found: Target="whoweare" Base="_level0.instance20.instance48.instance49"
this is the code that i am using:
on (press) {
tellTarget ("whoweare") {
gotoAndPlay (51);
}
}
View 14 Replies
Feb 16, 2005
so, i'm making an animated rollover, and i get an output error that says this:
Target not found: Target="_root.icon01" Base="_level0"
i have no idea what the base="_level0" means.
View 1 Replies
Aug 22, 2009
I'm using a combination of Paul Duncans php ZipStream [url]...
Works fine in Air, but when running Flex in browser, the zip needs to include a Adler32 checksum in the header for FZip to be read.
How can I calculate an Adler32 checksum for the zip in php?[code]...
View 3 Replies
Aug 18, 2010
i'm getting the xmldata from the httpservice (using cgi) and i have not set resultformat(it is coming as an object only),the xml data in this format
[Code]...
when i was tried to count the employee tag,i getting the problem, my code will like this:
[Code]...
View 1 Replies
Jan 14, 2011
I have the following function in my FogOfWar class, it calculates if its team can see the position that is passed on the arguments:[code]My problem is that, with only 3 characters in the game, it can only run 4000 times per second, which is not too much.I can implement a cache, so it caches the most commons positions, but, what else can I do to optimize it?
View 2 Replies
Oct 21, 2009
I need to calculate the value of a formula which is passed dynamically by using text box.This formula contains a set of variables which are already declared and assigned a value(hard coded). I will provide a submit button , on clicking this button I must be able to evaluate the formula that I have passed dynamically using the text box.
View 2 Replies
Apr 28, 2011
I have problems with calculating values of a childnode.
My XML structure
<FILE>
<NUMBER TYPE="test"> 1 </NUMBER>
<NUMBER TYPE="test"> 2 </NUMBER>
</FILE>
[Code].....
the trace outputs: 2 (last row)
and not 3 as i expected. De Element++ is not working.
View 2 Replies
Nov 30, 2006
I'm working on a game which will involve space battles, and automated turrets. The turrets are giving me the headache right now. Here's what I got so far.
[URL]
The problem is, that the turrets aim at the center of their target, instead of aiming in front of their target to compensate for their movement. I can't seem to crack the equations needed to get the right rotation, for the turret to fire from. The data the turret has avaible, or that I could easily make avaible to it, are:
- The distance to the target (and it's x and y components)
- The current speed vector (the size and rotation)
- The angle between the heading of the target and the turret's location
- The speed of the turret's shot (fixed speed)
View 2 Replies
Aug 30, 2003
write down the formulas that flash MX uses when you use the functions tan/sin/cos...I am trying to get a good grasp on these things and it
View 12 Replies
May 20, 2010
how to find the biggest possible area within a rotated image (the black rect in attached image), but can't figure out how to calculate the points TL, TR, BR, BL to draw my rectangle (the red rectangle in attached image).
View 3 Replies
Nov 9, 2009
I am trying to create a 30 day trial period limitation in Flash CS3. I am having a problem with checking the number of days. I am using zinc mdm to get the date of an external file. Following is the code I am using.
var d1:Date = new Date(mdm.FileSystem.getFileDate("c:\myText.txt")) ;
var d2:Date = new Date();
//(Date2 - Date1)/
[Code].....
View 8 Replies
Jan 16, 2012
I'm basically trying to emulate Photoshop's Vanishing Point tool where you can define the 4 2D points and the 3D plane is calculated from that information, in terms of the rotation of the plane relative to x y and z axes.
So if you have an image like this one:
And you define the points of the four corners, maybe like this:
It would define the 3D plane that the surface must live on relative to the x y and z axes. Researching this has led me to some tutorials on drawTriangles and Homographies, but they all seem to be focused on mapping bitmap data and I can't seem to find anything that defines a 3D plane itself.
View 5 Replies
Jul 8, 2009
I am trying to figure out a way to calculate time diffrence betweennow and a set timevar
settime:Number = 2:35am
and
now would be getDate();
[code].....
View 8 Replies