Actionscript 3.0 :: Create A Simulation Earths Orbit Around The Sun?
Jun 3, 2010
So im trying to create a simulation Earths orbit around the Sun. Before i begin coding i need to know earths real orbit lengths.Does anyone know the values of (A,B,X,Y) variables?And once i do get the values, what is the code for moving an object in an ellipse? I know i need to use cos and sin but i dont know the actual formula.
Edit: I found out that [A] is 152,098,232 km and its [B] is 147,098,290 km. I'll scale these down once i find out the [X] and [Y].
I am using this script to rotate one mc (cloud) around another (grass), but what I can't seem to figure out is how to change the rotation of "cloud" so that it is always facing the center of it's orbit
Code: var radius = 1200; var degrees = -120; onEnterFrame = function (){
[Code]....
right now I am just using "cloud._rotation += 1;", but it obviously doesn't rotate the correct way.
is it possible that i can make an elipse orbit in a 360 like a planet with out it looking like a flat papper?i want to make it seem 3d as if rendered.i want to import the globe of our world and make it go around.
I'm making a little kids game at the moment with all kinds of critters and such.I randomly place the critters around the stage. Now to give them some more life i would like them to wander around a little bit but not stray from their origin (the place they were initially put).Now i recon i should store their origin in some vars and then setup a timer (or an onComplete with any random tweening engine) and then get new random coordinates to tween too that are within range.I think.I'm not sure if i'm on the right track as i can't get this to work properly so far.
I'm in the final stages of my Papervision project and I need to have the camera orbit around its target in an ellipse rather than a circle on a mouse drag. The tricky part is I already am using some complicated logic to get it easing as well and I need them to work together.
ActionScript Code: private function upHandler(event:Event):void { isCameraRotating = false; } private function downHandler(event:Event):void { isCameraRotating = true; previousMousePoint = new Point(mouseX, mouseY); [Code] .....
I'm trying to make a car simulation. I've a car that moves with keys W,A,S,D and i've a map with size 1200x1400 and screen size 600x700.What i'm trying to do is when car moves any place on the map , screen shall show that area of the map. The area that car located on.
I need a proper array code for making a dynamic text field that up dates as the user pushes the keypad (btns) I played with some stuff like the one below and cant seem to make it work
I was wondering if anyone would be able to help me with a problem I am having. I am trying to develop a simulation of a browser in Flash, and need to have a button which allows users to be able to go back to a previous screen (e.g. another .swf file) which means I need the window to be to move between .swf files.
I have tried various methods I have found online, but none seem to be working.
i am currently making a flash "pond" with fishes in it, and i have the ability to add food pellets onto the pond, how should i make the movement of my fishes to the food x,y location ? so it will be smooth , rather than setting the x,y location of my fishes to the x,y location of the food pellets.Also is there a good place to learn how to make my fishes move by its own?Fish class
since i'll be asking so many qustion, I will put all my problem in one thread here I'm planning to make a traffic simulation with AS3.0
[Code]...
which will still run the if function when the error is below 1 pixel. but i dont really like things that isn't sure, specially I'll make tens of guide movements on the stage.
trying to load a new image and still making the previous_node on the background without any blink, most seamless possible, where I�m making the mistake...?
I'm trying to preload external swf files as needed and show the progress each time a file is being preloaded. It works exactly as intended when I simulate it on my desktop but not at all when uploaded on the web: first of all nothing happens up until 50% of the main movie is already loaded and then when the the attempt is being made to load additional content, some weird number displays (-214...%) instead of the percentage. Take a look: [URL]
I'm trying to preload external swf files as needed and show the progress each time a file is being preloaded. It works exactly as intended when I simulate it on my desktop but not at all when uploaded on the web: first of all nothing happens up until 50% of the main movie is already loaded and then when the the attempt is being made to load additional content, some weird number displays (-214...%) instead of the percentage. Take a look:
There are were several developers on the forums who asked various questions about keyboard simulation in Flash.While waiting for Godot I have posted a quick tutorial with a working example and code for both timeline and class-based app. Just pasted the code on timeline or make class a document class.URL...
currently I'm having some problems with my preloader.I have an as3 class website with the following code:
public function Website() { addEventListener(Event.ENTER_FRAME, PreloaderStart); } private function PreloaderStart(e:Event):void { var bt:int=loaderInfo.bytesTotal;
[code]...
I painted my stage black and when I simply run my flash file it traced "loaded" so everything is loaded well and it builds the UI. But when I simulate by pressing ctrl+ enter twice I get a white screen and after about 10 sec. (my swf is 1mb and it simulates at 100kbs) it displays the preloader instantly at 100% and loads my UI. So my text doesn't change from 0% -> 100% but I just get 100% when everything is loaded.
I'm trying to make a realistic scrolling terrain for a game I'm making. all of the movement and collision detection is 2d, but I need to make the terrain look more real.
does anyone have an algorithm for simulating a 3d terrain in 2d with the geom.Matrix class?
I know how to implement one, but I'm not sure about the logic for a transformation like this
Try to simulate the OnPress/OnRelease aspect of earlier versions. It is working so far, but when I press the space bar, it goes around once, then stops. If you check the output, it is looping back to the enter aspect, so it looks like it is not working, but it just keeps restarting. I need to make the enter frame event not work since the keypress is already down, and only work on the first time I press it.
var spacebarKeyDown:Boolean = false; stage.addEventListener(Event.ENTER_FRAME, moveChar); function moveChar(event:Event):void{ stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown); function checkKeysDown(event:KeyboardEvent):void{ [Code] .....
I am looking to make a 100% deterministic Flash simulation (for multiplayer RTS game). So far areas that require special attention identified: ActionScript Code: Math.random() // obviously, have to use Seeded random Number // floats are volatile, but that can be overcome by truncating precision For.. in and For Each loops: // the order of looping through properties on an Object is different every time
Where do I can find an example or a tutorial of a realistic simulation of a rope tied between two points? I need to make something similar to the interface of Reason, the music app.
Im looking into creating a very simple 3D (can be pseudo) infinite road animation with some random elements. Like the old Lotus game for the Amiga... Im really not sure where to start, or what to search for to start - and was hoping that someone could point me towards some tutorial or other useful stuff.I dont want to build a complex . its the infinite road simulation i try to create
I'm creating a game like a paper plane movement. The movement should start with the drag and throw effect . With the drag and throw speed, the paper plane must fly through the scene with a glide movement. I got confused with its physics.
I'm creating a simulation in which a large number of objects are added to vectors and then taken away in random order (as more are being added). To remove the objects, I splice the object from the vector it's in, and notify all the other objects that an object ahead of them was removed so they can change their indices accordingly. As far as I know, the objects have no other references (I think), and within the object, I set everything to null. I read somewhere that you can't put "delete this" in the class, so I didn't bother with that. Will this be sufficient to get the object garbage collected, or should I do something else? What are the best ways to get something like this garbage collected?
I am working on a Real Time Strategy (RTS) multiplayer game, primarily working from this source: [URL] - which is basically boils down, to running a simultanous 100% deterministic simulation on all clients, and only transmit User input. Which brings me to the Number type, which is a float, which cant be trusted to be the same on all systems, and that could desync the simulation? how to work with Floats in AS3, to make them deterministic/correct errors, or just dont use them at all?
I try to create a budget simulation, All the data insert by user in an input text "averageSum1 = ((Number(out1num1)) + (Number(out2num1)) + (Number(out3num1))) / 3;" Working perfect ! Now all the final calculations I am trying to translate to Columns chart of expenses and income columns that changes depending on the data. The whole tables system is working. Only with the visual translation to columns I'm not sure how to begin.
I`m workin on a cd-rom project about art analysis, paintings, artists, It is for a teacher that will use it in his classes.I need to learn how to simulate a blackboard, that he could click and paint on some parts of the paintings. Does anyone know a tutorial about that?
At the bottom I have some leaves there. I want to make a couple different size leaves like that and make them go from left to right at random paths and have it loop. I don't know much about actionscript but is there a way to do this without having to make a bunch of guide paths and doing lots of tweens and rotations?
I created a rigged character in Flash Prof. CS 5.5 that has a mouth that moves when the user types letters. Is there any way I can insert a line of code that will simulate the user hitting a key and thus trigger the functions that I have already written?
I'm trying to create a series of scripts that will create some custom event listeners.
I have three movie clips on my stage. One is a movieclip who's sole function is to hold array's and the event listeners. A second which moves around the screen. And a third that is motionless.
The problem is that the argument I want to test (which activates the custom event) is held within a string.
What I want to know is, how do you test to see if the string argument is true?
Is it something similar to this:
var myCode:String="1<0";if(myCode){ trace('one is smaller than 0'); //Strangely apparently one IS smaller than 0!!! }
I think I'm going about this in the wrong manner, however this is the only way I can think of this working... (since I need to be able to dynamically create these events)