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
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
My Tutorial for Using Trig In Game Development
Moderator: Coders of Rage
- TheAustech
- Chaos Rift Cool Newbie
- Posts: 96
- Joined: Fri Sep 03, 2010 4:38 pm
- Current Project: BeatTapper
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++, C#
- Location: Maryland
- Contact:
- TheAustech
- Chaos Rift Cool Newbie
- Posts: 96
- Joined: Fri Sep 03, 2010 4:38 pm
- Current Project: BeatTapper
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++, C#
- Location: Maryland
- Contact:
Re: My Tutorial for Using Trig In Game Development
Oh wow, so sorry. I completely overlooked the Game Development section. This would of been better in that section.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: My Tutorial for Using Trig In Game Development
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.
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.
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- TheAustech
- Chaos Rift Cool Newbie
- Posts: 96
- Joined: Fri Sep 03, 2010 4:38 pm
- Current Project: BeatTapper
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++, C#
- Location: Maryland
- Contact:
Re: My Tutorial for Using Trig In Game Development
Thanks, I'm glad you liked it : )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.
- epicasian
- Chaos Rift Junior
- Posts: 232
- Joined: Mon Feb 22, 2010 10:32 pm
- Current Project: Gigazilla Engine
- Favorite Gaming Platforms: Dreamcast, SNES, PS2, PC
- Programming Language of Choice: C/++
- Location: WoFo, KY
Re: My Tutorial for Using Trig In Game Development
This will definitely be useful when I attempt to make a top down shooter. Thanks for the share! :D