Chomper Stomping jQuery/JavaScript/CSS 3/HTML 5, Java/PHP/Python/ActionScript, Git, Chrome/Firefox Extensions, Wordpress/Game/iPhone App Development and other random techie tidbits I've collected

24Sep/072

The Parts of a Triangle

Anyone remember Trigonometry? No? Me neither... Oh, wait, that's right, I never really took it. Well, I took Algebra and Geometry, but never a class specifically called Trigonometry. Is there such a thing? I'm sure there is. Anyways, I'm re-learning the parts of a triangle and how to find them.

Here is what I have figured out so far:

Why am I doing this? Well, I have to if I am ever going to get this game working.

Here is what I found out (after buying a $40 book to learn this. Excellent book by the way...):

In order to bounce a circle or bounce a ball off of a slope you have to bounce it off of not a slope. Yeah, let me say that again, you just basically don't bounce it off of a slope. What? Well, there is no such thing as a slope. There is flat, and then there is flat. To you it looks like a slope, but really it isn't. It's just a flat surface.

I know, I know, I'm not making sense here. Let me clarify. The only reason it looks like a slope to you, is that you are not on a level plane with it. A line is a line is a line. Tilt your head far enough and this: | will be flat and level. I'll venture to guess you only had to go about 90 degrees either way and that line became flat.

It's the same thing with flash:

  1. Take your angle
  2. Make the computer tilt it's head until you no longer have a sloped line (but rather a horizontal line)
  3. Do your calculation (make it bounce off of that line)
  4. Tell the computer to tilt it's head back

So, now I take the method I described a few days ago for finding the "slope" of the surface the ball is interacting with, and use the triangle that is formed by that interaction to apply this bounce method and I've got the main motion mechanics of my game working.

Should be easy. Hah! We'll see...

Comments (2) Trackbacks (0)
  1. Wah?

    No seriously, this is amazingly interesting. I wish I could actually watch you going through whatever program you’re using. And yes, I took a trig class, it does exist.

  2. Thanks Art! I’m glad someone finds it interesting.

    I’m afraid you would be terribly bored watching me, because this (sadly) takes me hours to do. But if you ever want a quick primer, and we are ever near a computer with flash, and I happen to have my portable hard-drive, I’d be happy to give you one.

    I guess that’s why people who do it for a living make good money though, and I’m sure this piddly stuff I am messing with takes them like 10 minutes…


Leave a comment

No trackbacks yet.