Page 1 of 1

My Tutorial for Using Trig In Game Development

Posted: Fri Sep 03, 2010 10:21 pm
by TheAustech
Hey, I remember before when I first tried making a top down game I had no damn clue on how to get the bullets to move towards my mouse. I was so desperate that I literally made about 50 if statements that checked for the mouse position (yeah, I had a lot of time on my hands). Then I learned about this magical unit circle and trig functions :worship:

I learned these functions in my math class, but luckly I'm an awesome dude and I made a tutorial which I personally think explained it well. But then again I know the topic so...

Anyway, the video is here: http://www.youtube.com/watch?v=FmWDD9AXUEQ



This tutorial uses images and displays I drew out for hopefully easy learning. Also I'm not giving you the code on how to make a bullet move in that direction. I'm teaching you how to use a very important function to get the way it should move. I don't know what library you use or what everyone's code looks like so I can't just say "Type bullet.move(atan2(blah))" because that wouldn't work for everyone, not even mine :lol:

Re: My Tutorial for Using Trig In Game Development

Posted: Sat Sep 04, 2010 1:32 pm
by TheAustech
Oh wow, so sorry. I completely overlooked the Game Development section. This would of been better in that section.

Re: My Tutorial for Using Trig In Game Development

Posted: Sun Sep 05, 2010 12:04 pm
by ibly31
Nice! I've pretty much figured out most of that before so I didn't learn anything from it, but it was very clear and I really wish I had found this (or it had been created) back when I couldn't figure it out.

It's nice to know that the technique that I use is the one that most people use! Also, I never really knew about the unit circle (going into Functions this year), so it was cool to see how all that worked out and was related to this.

Re: My Tutorial for Using Trig In Game Development

Posted: Sun Sep 05, 2010 2:37 pm
by TheAustech
ibly31 wrote:Nice! I've pretty much figured out most of that before so I didn't learn anything from it, but it was very clear and I really wish I had found this (or it had been created) back when I couldn't figure it out.

It's nice to know that the technique that I use is the one that most people use! Also, I never really knew about the unit circle (going into Functions this year), so it was cool to see how all that worked out and was related to this.
Thanks, I'm glad you liked it : )

Re: My Tutorial for Using Trig In Game Development

Posted: Thu Sep 09, 2010 2:36 pm
by epicasian
This will definitely be useful when I attempt to make a top down shooter. Thanks for the share! :D