ActionScript 3.0 :: Friction Increase As Distance Decreases?
May 10, 2010
I for the life of me can't figure out this simple equation that I want for a camera-following function.As distance decreases, friction increases.Friction being a number between 0 and 1, where friction = 1 is no friction.
View 2 Replies
Similar Posts:
Nov 10, 2007
I have a billiard ball system, whic detects collisions between balls and modifies their x and y velocities accordingly.I have included a friction variable and I have a very basic system for applying the force of friction for each iteration of movement:
private static var FRICTION:Number = 0.94;
public function move() : Void[code]....
This works to a reasonable level of satisfaction, but it doesn't quite feel right. The balls seem to take just a little too long to stop when they've slowed down to a very small velocity. I've tried tweaking the friction constasnt, but I still can't get sometthing that feels exactly right.
View 3 Replies
Jun 17, 2005
I am working on the project where everything is based on the distance from the center of the stage. First I made this fla where flash outputs the x and y distance from the center. First problem is that I want to output distance only in positive numbers.
View 1 Replies
Oct 16, 2010
I am posting my code that attaches the movieclips on stage
[Code]...
i was hoping that when the newMc expands, all other mc would keep the same distance between each other as at initialisation. I not able to figure how to do it. maybe even an earlier post or llink where similar query was explained.
View 1 Replies
Apr 28, 2011
In AS3 I am trying to get the distance between 2 3D objects by using distance method.
if(Vector3D.distance(model.position,model2.position) < 100)
{
// do something
[Code]....
>>You can use it directly as a method of the Vector3D class to get the Euclidean distance between two three-dimensional points.
Which point does this method pick? Is it the closest point to the other object ?
I am just thinking of how much time this would take in testing objects with large poly count.
View 1 Replies
Aug 19, 2011
How can I increase the _height property of a window without increase the height of the title and the bar at the top of the window ?
I want only to increase the part of the window where I put textFields and buttons.
View 6 Replies
Aug 19, 2010
I'm used to applying basic friction like this:[code]The problem is I don't know how to convert this to be described over time, so that can reduce the value based on the amount of time that has passed.Say I want to reduce the value to compensate for 1 second passing, or 500ms? How does that work in to the equation?
View 9 Replies
Apr 23, 2009
I'm attempting to make a racing game. I want to make it so the user has press two other keys alternately in order to speed up. While the user is not pressing those keys the player should slow down gradually. I'd also like to add friction. Right now, I have code for basic movement:
[Code]...
View 1 Replies
Jun 6, 2010
This is my scenario
1: I upload an image
2: Without altering it,I make a copy of it and use it display to users in resized format note: I won't display the original image.
3:Now when user deletes the resized image,i need to delete the image loaded as bitmap i.e. the original image which i won't be displaying
For that I used bitmap.bitmapData.dispose() method.But,it doesn't free up the memory taken by the bitmap. For instance at initial state the memory usage is 58 Mb and upon loading 3 images the size increases to 87 Mb. And when I delete all the images the size decreases to 81 MB only. So,I feel the loaded bitmap is not completely removed.
View 9 Replies
Apr 3, 2010
After I imported a .mp3 or .wav in Flash, and I check the sound in the library, the quality of the sound has decreased. Why does an import effect a sound, and how do I solve this? (PS: I do not mean that the sound-quality decreases after publishing, I know I can change the settings)
View 1 Replies
Jul 31, 2011
Got this problem here with my thumbnail scroller, and I'm sure it's a fairly simple solution. Basically, it scrolls fine, but the scroll speed never decreases, meaning it scrolls really fast the whole time. I'd like it to accelerate/deaccelerate if possible. Here is the code I'm using for the scrolling:
Code:
thumbHolder.addEventListener(MouseEvent.MOUSE_OVER, thumbScroll);
function thumbScroll(evt:MouseEvent) {
[code].....
View 1 Replies
Mar 30, 2004
I have a few buttons and when I make them a symbol, they look like crap. Any trick to make symbols look as good as the imported bitmap?
View 12 Replies
Jul 31, 2005
I wrote this 9ball game a while back (never really finished it), and was showing it to a friend today. When a pool ball is rolling fast, less of it's mass should be touching the felt, therefore, less friction. As it slows down, there should be more contact with the felt, and therefore, more friction. Any realistic algorithm to use to adjust the friction higher as the balls slow down? [URL]
View 11 Replies
May 23, 2008
I have a MC (icCost) whose _yscale is = to a dynamic number (icc) specified by a formula that uses input text. I set up a listener to see if the length increases or decreases but im not sure if I did it right since it doesn't work
[Code]...
I have a feeling I need a variable that stores the previous number and compares it to the new number. I do not know how to do this though.
View 3 Replies
Nov 12, 2009
when I'm running and not holding my keys down then the friction should slow me down. That works but the speed never stops at zero. I can't see him moving but I've put a text that draws his speed, because if the speed isn't zero and I'm not pressing any button then he will slide and that doesn't work look here: [URL]
The code in the player I use is:
[Code]....
View 1 Replies
Dec 19, 2005
I have an idea for something at work. I want to have stars hanging by strings from the top of my flash document. if the user mouses over these stars I want the star to lightly swing in the direction the mouse went over at. Almost as if you had a cardboard star hanging from the ceiling and you tapped it with your hand. I know this probably includes friction but my tests don't seem to work out the way I want. Does anyone know how to achieve this?
View 8 Replies
Feb 20, 2008
i have a project and i need that when a specific variable equals a specific value a random number decreases on the current number, its easy to make it decrease but i need to decrease instead of 4 to decrease a maximun of 5 and minimun of 3.ere is the code :
Code:
numeroDeTazos = 20;
quantidade.text = numeroDeTazos;
if (nrfinal2 == 33)
{
[code]....
View 1 Replies
Jun 19, 2011
Can't figure out this. I have 3 points A(305,108),B(311,119) and C(348,172), to find out the distance from B to AC, i use a method found here [URL]..
I then got the distance equals to 131. When I draw AC and B, it appears B is almost on the line (distance <= 1). Am i doing wrong? what does 131 mean?
View 1 Replies
Apr 19, 2011
Is there any difference between: distance = point1.subtract(point2).length; and distance = Point.distance(point1, point2);
View 3 Replies
Apr 6, 2011
I cannot arrive at dynamically showing the text in the dynamic text field when I move one any one of the MC on stage.
View 6 Replies
Nov 22, 2011
I am working on a project where I have 5 equal sized panels inside of a MC that I am using the following code on the loading of MC:
onClipEvent (load) {
targetx = 650.0;
delay = 8;
}
[Code]...
What I would like to do is ALSO move the panels with left and right arrows that act independently of navigation buttons. So that if you were on panel 2 you could advance to panel 3 or back to 1. Can I assign AS to the arrows to move the MC a specified distance left or right?
View 2 Replies
May 20, 2008
I'm building a touchscreen project that consists of flash and max/msp using Olaf Matthes flashserver as bi-directional control.
how I create a function in flash that will provide me with the distance of a concentric circle, so that as it grows I can use trace() to give me a constant stream of it's x & y coordinates?
I've also implemented a collision detection between two or more circles for the purpose of an overlap function. Trouble being that it's not quite working properly. I want the overlap function for the purpose of morphing sounds between the intersecting parts of the circles.
Here's the code I'm using:
[Code]....
View 2 Replies
Jan 14, 2009
Is there a way to calculate the distance between the origin of a movieClip at, say, (x:500, y:0, z:0) and one at, (x:500, y:0, z:50)?? And lets say the vanishing point is (0,0) and the perspective angle is 50.
I know that the eq for finding the distance between two points in 3D space is:
d = ((x1-x2)^2 +(y1-y2)^2+(z1-z2)^2)^(1/2)
the problem is I dont know x2 (the x value of MC2 (the one set at z = 50)).
[URL]
View 2 Replies
Aug 8, 2010
At first it seemed simple to find out the distance between two movieclips' x values, I could have just done:
Code:
mc1.x - mc2.x
However, What I'm trying to achieve is a movieclip of a person climbing an un-even surfaced wall, and to do this I first want to make sure the x value of the person is always equal to the edge of the wall.
How would I calculate the exact position of wall's edge where the person is touching it? I've attached an image to show what I mean.
View 3 Replies
Aug 7, 2010
I have a vertical list of movieclips added to the stage all spaced out evenly from top to bottom based of the last movieclips position. I also have defined a center Y point which I would like to find out the percentage of each clip away from that center point. The reason for this number is to scale everything from the center point which is scale 1 then they next item from the center would scale to a percentage from the center point. each clips scaling percentage would be based off of how far they are from the center point in each direction. Keeping in mind the center point is always scale to 1. I also want to make sure my scale never goes below 0.3 so the range has to be between 0.3 and 1 my centerY is also not half the height of the content but a number I decide. AS it the content might be 1000 in height but the center point could be set to 300.
[Code]...
View 6 Replies
Oct 27, 2009
I've scanned through the forums, but can't seem to find an answer to my question. I'm trying to move (tween) a movie clip 800 pixels along the x axis (horizontally) when a every time button is clicked. I don't want to move the movie clip to the 800 "x" pixel mark. Yet, I can't seem to move the clip an additional 800 pixels whenever the button is pressed again - it keeps starting from the original spot. I am new to ActionScript...
My code is below:
btnBottom1.addEventListener
(MouseEvent.MOUSE_DOWN, playHandler);
function playHandler(evt:MouseEvent):void {
import fl.transitions.Tween
import fl.transitions.easing.*;
var twTeen:Tween = new Tween(mcbottomFlap1, 'x', Elastic.easeOut, mcbottomFlap1.x, +800, 3, true);
}
View 3 Replies
Oct 28, 2009
I'm trying to get the distance between two objects. Problem is that both objects are -45º rotated but one of them moves up and down with stage resize. So the distance gets a random degree. I've attached an image so that it could be simpler to understand my problem.
View 3 Replies
Dec 9, 2011
I'm trying to calculate the distance between two images (A and F - there are other images between A and F) but I can't seem to figure out how to do it the right way. The image A.x is "(stage/2) - (A.width/2)" and image F.x is "E.x - imgSpace" which is a negative value (all the images x is of negative value to image A.x). In my oppinion the calculation is F.x - A.x and although it might be right I still ned the value to be non-negative.
View 3 Replies
Dec 28, 2011
I am trying to do something like this[code]...
Then how do I make it so all the children added are equal distance apart? I know I can set the X coordinates for each one,but I want it so that the objects can be added in any sequence and then be set to equal distance apart.
View 3 Replies
Mar 28, 2011
Not sure this exist, but worth asking you all: is there a built in method to compute the distance between the current mouse position and a given component? If not, is there a simple way to build a function like this that works for components with generic shapes?
View 2 Replies