Pimpin' Flash Games

Ah, that would be a constant force. That’s as good as any. In real life, the Gravity Amount would be less and less as you got further from the planet. It probably would make the game tougher, though, if gravity changed depending on how far out you were. Good stuff! I love orbital mechanics.

Ok Shade, help me out here.

I’ve been trying to learn trig for the better part of the day (my head is starting to hurt).

The Lander moves in a ‘vector’ (is that the right term?)

For example every frame I tell the lander to move
5 pixels on the X axis and
3 pixels on the Y axis

With those two numbers I should be able to figure out the angle of incidence… I think.
atan(Y / X)*(180/Pi);

Using this formula… I think I’m getting the right numbers for angle of incidence. (I’m not really sure as I’ve just rencently stumbled across atan (aka. tan-1).

Now, how do I figure out the angle of reflection?
Or am I not considering something since the object is a sphere?

“Math is hard!”
–Barbie

I logged in with my admin username, and all was well.

Ahhh. working in IT.

Schweet!

Excellent game!

A minor mod that may help those who want a radar because they overshoot: position the lander on the screen slightly behind centre and move it farther back depending on its speed.

In other words, if you’re going clockwise at the top of the planet, the screen should be centred somewhat to the right of the lander. That way you can see more of where you’re going than you can of where you’ve been.

If you want me to clarify, or give more details as to how you might accomplish that, post your questions.

Good luck with the job!

Before the collision with the planet, the lander is moving with a velocity (v[sub]x[/sub], v[sub]y[/sub]). In your example, v[sub]x[/sub] = 5 and v[sub]y[/sub] = 3. Let’s call the velocity after collision (w[sub]x[/sub], w[sub]y[/sub]). Now, the fact that it’s intersecting a sphere does come into play, and I’m leaving out several lines of trig. I will assume that the planet’s center is at the origin (x, y) = (0, 0). So that at the surface of the planet, x[sup]2[/sup] + y[sup]2[/sup] = R[sup]2[/sup], where R is the radius of the planet. You can write (w[sub]x[/sub], w[sub]y[/sub]) in terms of (v[sub]x[/sub], v[sub]y[/sub]) like this:

w[sub]x[/sub] = -v[sub]x[/sub]cos(2 theta) - v[sub]y[/sub]sin(2 theta)
w[sub]y[/sub] = -v[sub]x[/sub]sin(2 theta) + v[sub]y[/sub]cos(2 theta)

Theta is an angle that describes your position around the planet, given by tan(theta) = y/x. Remember, I’m using (x, y) to denote your position. However, it’s best to avoid trig functions in programs if you can, and you can in this case. Use the following formulae:

sin(2 theta) = 2 x y / R[sup]2[/sup]
cos(2 theta) = (x[sup]2[/sup] - y[sup]2[/sup]) / R[sup]2[/sup]

I’m sorry, I have to agree with Achernar on this one. I had something to do tonight.

You shall burn in hell for this.

:mad: :mad: :mad: :mad: :mad:

I really should be going to bed, but seeing as how I’m snowed in and working from home anyway…

Oh, and “Diag #1 Space magic” :smiley: Pure insane genius.

Achernar nailed it. Damn sleep

Well, I enjoyed that a lot.
Thanks.

Thanks Achernar and Shade :slight_smile:

I promise I’ll figure out your crazy math squiggles and get bouncing working. Thanks for the help!

A videogame website Bluesnews (http://www.bluesnews.com) has picked up a link to The Lander. I’m getting a hit every few seconds :eek:

650 hits before 8:00am.

I’m hoping my friend’s server really does have the unlimited bandwidth he claimed.