ActionScript 2.0 :: Set Boundaries For The Y Coordinates Of A Falling Box With Gravity?
May 20, 2004
how to set boundaries for the y coordinates of a falling box with gravity. i am using the gravity AS, and i could not find a specific tut for setting the floor boundary.
View 1 Replies
Similar Posts:
May 20, 2004
how to set boundaries for the y coordinates of a falling box with gravity. i am using the gravity AS, and i could not find a specific tut for setting the floor boundary.
View 1 Replies
Oct 17, 2010
I have some code here for some falling leaves. I was wondering how it can be altered so there is a delay between a group of leaves falling and the next group falling? also to slow down at the end of the fall? [code]
View 9 Replies
Dec 19, 2011
I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue
var lp:Point = new Point(e.localX,e.localY);
I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2
var lp2:Point = new Point(e.localX,e.localY);
now surprisingly it was giving correct values as expected and I went back and changed the code as
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);
now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.
View 1 Replies
May 21, 2007
I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:
transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....
I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:
red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);
View 4 Replies
May 3, 2010
Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.
View 2 Replies
Sep 14, 2009
I worked on a new Flash project, but I cant seem to find a good solution for how I want my objects to collide. In my project I have: a Ball(moving object) and a Floor(not moving).
The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
[Code]...
Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it? Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?
View 1 Replies
Sep 14, 2009
In my project I have: a Ball(moving object) and a Floor(not moving).The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
[code]....
First: the -23 in the code is what I don't like. Second: every single object that deals with collisions would need to be put into the if statement.Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it?Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?
View 2 Replies
Sep 14, 2009
In my project I have: a Ball(moving object) and a Floor(not moving).The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
Code:
var gy:Number = 0;
var gravity:Number = .2
function ballMovement(event:Event):void{
[code]....
First: the -23 in the code is what I don't like.
Second: every single object that deals with collisions would need to be put into the if statement.Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it?Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?
View 1 Replies
Jun 14, 2005
referring to Pom's tutorial on gravity (up and down), I was wondering how to alter the code to make it so that the object moved and bounced along the x-axis. I tried this:
Code:
onClipEvent (load) {
gravity = 2 ;
// We get the time when the ball is released for the
[Code].....
View 5 Replies
Jun 24, 2003
i'm trying to recreate gravity. this is what i have so far:
[AS]G = 0.005;
m1 = ball1._width;
m2 = ball2._width;
scrnW = 550
scrnH = 400
[code]....
the script looks alright to me but when run, the effect is wrong...
View 14 Replies
May 14, 2010
I am using Box2d 2.02, and am having trouble with setting linear velocity of a body in 0 gravity. When I trace GetLinearVelocity() when left is pressed, it reports the correct vector (-20.0, 0.0) but the body does not move. It is a dynamic body.
Code:
if (Key.isDown(Keyboard.LEFT)) {
if (mover.IsSleeping()){
mover.WakeUp();
}
mover.SetLinearVelocity(new b2Vec2( -20.0, 0.0));
}
View 1 Replies
Oct 15, 2010
I'm making a game were parts of the level are randomly generated and move across the screen and while I have made it so all that works correctly I am having trouble running a hittest on them to allow for gravity. Below is the piece of code attached to the player movieclip that I think is causing the issue (shortened for sake of space)
[Code]...
View 3 Replies
Oct 5, 2003
I am creating a flash animation for my physics class. I am demestrating free fall. I know how to create a free fall object, but how would I make it so that the user can change the gravity?
View 12 Replies
Sep 15, 2004
check this code onClipEvent (load) { k = .2; damp = .9; grav = .1; } onClipEvent (enterFrame) { ax = (_root._xmouse-_x)*k; ay = (_root._ymouse-_y)*k; vx += ax; vy += ay; vy += grav; vx *= damp; vy *= damp; _x += vx; _y += vy; } tell me where am i going wrong??? cos after giving the code to mc its not responding in any terms except the drag and drop to the invisible button.
View 4 Replies
Aug 16, 2005
i have a game where fish fall out the sky and a penguin on ice skates has to catch them before the fish get to heavy for the ice, the ice cracks and the ice skating penguin falls into the water and freezes. I have all the code but cant work out how to set the random location along the Y axis for the fish to fall. I have a gravity script but cant work out how to include the random position for the fish. There are 30 fish and i want to be able to have one fish fall wait a half a second and have another fall and so on....until all 30 have been dropped...
My gravity script is this:
ymov = 0;
grav = 2;
_root.onEnterFrame =function() {
ymov += grav;
[Code].....
Anyone know how i could set a random location in this or something similar?
View 1 Replies
Jan 19, 2006
I want to do gravity effect on a ball . I found some thing do this but I need to make the ball goes to the floor direction actually I want it to follow the sloping of the floor with the gravity effect .
View 14 Replies
Oct 2, 2008
I'm trying to find a way to do a cable in papervision(great white) that has the behavior(gravity and elasticity) like the following two links:url... Any clues as to how should I approach this?
View 2 Replies
Nov 3, 2009
Code:
var spring:Number=.1;
var frizione:Number=.98;
var gravita:int=1;
var limite:Number=stage.stageHeight;
stage.frameRate=31;
var colorsArray:Array = new Array();
[Code] .....
View 2 Replies
Oct 8, 2011
I've made a character, and used the bone tool to make it move in runtime.This works fine, but now I want to add gravity/physics, so I can throw my character and it lands on the ground like a real ragdoll. How do I do this in actionscript 3 ? And is it possible to do this within the fla (no class file).
View 1 Replies
Nov 24, 2003
i designed a ball that falls down in soft place and goes under the eart ...when we carry this ball uper ...ball goes more under the eart...i make this ball dragable and with varible speed=..... &...&...make this ball.but may metod its not good.and not works correctly.
View 1 Replies
Apr 4, 2003
I am in a pinch for time and know very little about Flash and even less about Actionscript, but I need to know how to make a ball fall according to gravity!
Thomas
<a href="mailto:ttorrey@slc.edu">ttorrey@slc.edu</a>
View 14 Replies
Aug 16, 2006
I have a move that has a bunch of boxes that drop into the screen and bounce with a little gravity at the bottom of the window.
Code:
for (i=0; i<4; i++) {
var clip:MovieClip = attachMovie("circle", "circle"+i, getNextHighestDepth());
[code].....
View 5 Replies
May 16, 2008
I have a file where two objects fall from the top of the stage and bounce and then eventually stop (using gravity and hit test). You can grab the objects (a ball and a box --- each has a button symbol n the movie clip) and toss them and they bounce off each other and off the 4 sides of the stage. The issue is when one of the objects is dropped directly on top of the other object, after it stops bouncing, it slides down until it hits the bottom of the stage (in this case, the box slides down in front of the ball, and the ball slides down in back of the box).
[Code]...
View 8 Replies
Nov 24, 2003
i works on phisic project...(learning phisic for childs)...i designed a ball that falls down in soft place and goes under the eart ...when we carry this ball uper ...ball goes more under the eart...i make this ball dragable and with varible speed=..... &...&...make this ball.but may metod its not good.and not works correctly.
View 1 Replies
Jul 13, 2011
Is there already a AS3/Flex solution for swiping lists (or other elements) with gravity like the app list on andoird devices?
View 1 Replies
Mar 23, 2012
I have a problem with Map objects, while using Gravity. All messages works ok, except the ones which includes Map objects. They throw the following exception:ArgumentError: Error #2173: Could not read the object in the stream. though lass:org.granite.collections.BasicMap do not implement flash.utils.IExternalizable,but we know that it's Class:externalizable by its alias.I've found that this error occurs when you do not include granite-essentials.swc, but I don't think that's the case, because normal messaging using RemoteObject works fine, even with Map objects
View 1 Replies
Jun 8, 2010
hi does anybody know how to make gravity invert or flip when a mc collides with a box?
View 1 Replies
Oct 8, 2010
Currently, I'm developing a drag 'n' drop 'snap' game in flash. The meaning of this game is to drag ''crates'' from a boat and load the crates into a train.
What I got working in AS2:
- The crane arm follows the mouse cursor.
- It can drag and snap objects(crates)
But what still need to works is:
- When mouse button on object is released, the object (crate) is still floating in the air. When released mouse button, the object must fall down. (gravity)
View 9 Replies
Jan 21, 2010
I'm just starting out in actionscript 3.0, and I'm trying to create a basic platform game. Since I don't really have time to code it from A to Z, I'm using an 'engine' I found here. I've made a few modifications (mostly deleting stuff I don't need, such as the enemies and the coins). Now I'd like to create a crate that the player character can pick-up, throw, put down and jump on. I've created a new class (Cage.as) for it, based on the player class. When I run the game, the crate is displayed, but it just floats there. I can't figure how to make it interact with gravity (i.e. fall to the ground).
View 3 Replies