Gravity

Gravity sucks, i want to FLY !!

So That’s what I want : A flying SuperIlyas 0] that you can control, but there must be some gravity in it !!!\r\rpom

Here’s the result. Any idea ?\rpom

hope this helps:\r<a href=http://www.danalu.com/thoriphes/gravity.swf>here</a>\rif you need to see the fla, then let me know, but all the script in the movie is seen on the swf anyway…

this site came up when i was looking for real equations:\rhttp://library.thinkquest.org/16600/\r\rit’s a great site.\r\ri made something, it’s not really based of real equations like i’d hoped, but it’s at least indicative. the slider adjusts the gravity.\r\r<EMBED src=“http://members.shaw.ca/rlinton/posts/gravity.swf” quality=high bgcolor=#FFFFFF WIDTH=300 HEIGHT=300 TYPE=“application/x-shockwave-flash”></EMBED>\r\rthe code on ball is:

<font color="#000070">\ronClipEvent(load){	_quality = "LOW"; // not really necessary	y = _y;	d = .985; // drag	g = .5; // gravity}onClipEvent(enterFrame){// make sure we're not stoppedif(!stp){	// if our destination is beyond the barrier, and we're going down	// i think the direction check will solve your problem	if(y+ymov>270 && ymov>0){		// if we're just looping this frame, stop		if(count<2) stp=1;		y = 270;		// invert direction with a little friction		ymov*=-d;		// reset the count		count=0;	}else{		count++;		ymov += g;		y+=ymov;		ymov *= d;	}	_y=y;}}</font>

Oh supra’, my scripting god, this might be one for you:\r\rwww.friendsofed.com/books…index.html\r\rseems to be new -and expensive- haven’t had a chance to get a look yet…

Thoriphe, thank you very much, your script is clear as holy water (as always).\rSupra, I don’t understand the utility of count. Very interesting link by the way.\rEyez, that book looks awesopme. If you ever buy it ($50 !!, @#%$ !!), you know where to find me…\r\rpom

OK, so here’s the ultimate gravity simulation. And Supra, this one’s based on physics law. Actually, I used Thoriphe’s script to make it work since I don’t understand how yours work.\rHere’s the lowdown : mass * acceleration = sum of the forces (here : weight only)\rSo acceleration = gravity constant G\rand velocity = G*Time elapsed + original speed\rAnd you get this :

Where’s the replay?\rBy the time the page is loaded, the anim is over :slight_smile:

Couldn’t do it… Dammit !! You got me, Austin Powers !\rAny idea how to reset a timer ?\rAustin\rOk got round it :

Why doesn’t it work when you edit and add the “custom signature” ?\rpom\rDammit !!!

I hate it !!!\rBy the way, the ball seems to float a little bit because I set the gravity to 1 instead of 10.\rpom\r\rPS : By the way, I noticed that your ball can be dragged, Supra. But it doesn’t keep its speed, it just falls down. Any idea how to solve that ?

I’m having fun, or should I say… phun ? 0] Now you can drad the ball and give it the speed you want.\rpom

here’s a modifyied version of the previous swf i made, only i’ll need to give you all the fla since the code is in numerous places.\r<a href=http://www.danalu.com/thoriphes/gravity.swf>swf</a>\r<a href=http://www.danalu.com/thoriphes/gravity.fla>fla</a>

Thanks, but I kind of managed to do it after all.\rTell me, how come your animations look good and mone look like @#%$ ?\rpom

cool…\r\rthe count was to stop the ball from vibrating perpetually at the end of it’s bounces, kind of a hack solution.\r\reyez, cool book, but $$$. geez.

i also forgot to mention, to get a clean, smooth looking animation, i recommend raising the movie’s FPS to something like 50 (which i use all the time). remember, an onClipEvent(enterFrame) is just like an animation on the timeline.

This is really awesome! I have never known how to use gravity, and I gave up on it a few months ago.\r\rCheers,\rKirupa

This is so way alot supercool! I am studying the script and thank you for it Thoriphes. So cool. \r\rpj\r:cool:

Thoriphes,\r This is so phun. I emulated what you did in your movie by recreating it. Since I am not a man of action (yet) I had to paste and copy your script. But it didn’t werk right until I reread your post about the FPS. And it works! Looks just like yours. Mind you this just shows I have a fundemental understanding of how flash works and am good enough to recreate a masters scripts as long as I have the scripts. (I know, not saying much) But I am learning.\r\r Q: What are some good tutorials I can learn these basic principles; And remember, give me ones that won’t frustrate the hell out of me, something even a flashhopper can understand.\r\r Q; Can people that aren’t good @ math learn this just the same or is that a prereq?\r\rpj\r:cool: