# Pimpin' Flash Games

**URL:** <https://boards.straightdope.com/t/pimpin-flash-games/162183>\
**Category:** Miscellaneous and Personal Stuff I Must Share\
**Created:** [March 18, 2003, 2:10am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183 "2003-03-18T02:10:36Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Achernar](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Achernar](https://boards.straightdope.com/u/Achernar)\
**Post date:** [March 18, 2003, 10:49pm UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/21 "2003-03-18T22:49:23Z")

</div>

> [@](#):
>
> \*Originally posted by pung \*  
> Xgravity = cos(Angle to the Planet) \* Gravity amount

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.

---

<div class="post-metadata">

**Author:** ![pung](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@pung](https://boards.straightdope.com/u/pung)\
**Post date:** [March 18, 2003, 11:40pm UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/22 "2003-03-18T23:40:04Z")

</div>

> [@](#):
>
> \*Originally posted by Shade \*  
> \*\*Would it be possible to bounce of the planet more realistically? (That is, if you’re going clockwise and down, and bounce, end up going clockwise and up. I can produce some maths for that if you want.)  
> \*\*

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

---

<div class="post-metadata">

**Author:** ![Wonko\_The\_Sane](https://avatars.discourse-cdn.com/v4/letter/w/258eb7/32.png) [@Wonko\_The\_Sane](https://boards.straightdope.com/u/Wonko_The_Sane)\
**Post date:** [March 19, 2003, 2:31am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/23 "2003-03-19T02:31:58Z")

</div>

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

Ahhh. working in IT.

Schweet!

---

<div class="post-metadata">

**Author:** ![stypticus](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@stypticus](https://boards.straightdope.com/u/stypticus)\
**Post date:** [March 19, 2003, 3:18am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/24 "2003-03-19T03:18:42Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Achernar](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Achernar](https://boards.straightdope.com/u/Achernar)\
**Post date:** [March 19, 2003, 6:30am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/25 "2003-03-19T06:30:13Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![Seven](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Seven](https://boards.straightdope.com/u/Seven)\
**Post date:** [March 19, 2003, 7:47am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/26 "2003-03-19T07:47:37Z")

</div>

> [@](#):
>
> \*Originally posted by Achernar \*  
> \*\*
> 
> Normally, I would praise you for such a great accomplishment, but since I have a term paper due Thursday, I hate you. 😉 \*\*

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:

---

<div class="post-metadata">

**Author:** ![sciguy](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sciguy](https://boards.straightdope.com/u/sciguy)\
**Post date:** [March 19, 2003, 8:14am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/27 "2003-03-19T08:14:16Z")

</div>

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” 😃 Pure insane genius.

---

<div class="post-metadata">

**Author:** ![Shade](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Shade](https://boards.straightdope.com/u/Shade)\
**Post date:** [March 19, 2003, 11:27am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/28 "2003-03-19T11:27:05Z")

</div>

Achernar nailed it. Damn sleep

---

<div class="post-metadata">

**Author:** ![Aslan\_of\_Narnia](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Aslan\_of\_Narnia](https://boards.straightdope.com/u/Aslan_of_Narnia)\
**Post date:** [March 19, 2003, 11:37am UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/29 "2003-03-19T11:37:23Z")

</div>

Well, I enjoyed that a lot.  
Thanks.

---

<div class="post-metadata">

**Author:** ![pung](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@pung](https://boards.straightdope.com/u/pung)\
**Post date:** [March 19, 2003, 1:03pm UTC](https://boards.straightdope.com/t/pimpin-flash-games/162183/30 "2003-03-19T13:03:09Z")

</div>

Thanks Achernar and Shade 🙂

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](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.

[Previous page](https://boards.straightdope.com/t/pimpin-flash-games/162183.md?page=1)
