Hi, the other day I was thinking "I want to make a 2D shooter" but how would I shoot at angles, I think I have worked it out but just wanted to run it past you guys.
Say I wanted to shoot up and right a small amount I would do y-1 every refresh and add to an array every refresh, once the array = 3 I would do x+1 thus creating a diagonal line or path of a bullet, I think this would work but just to check.
Thanks, Wolfy87.
Page 1 of 1
Just an algorithm No specific language
#2
Posted 04 May 2009 - 05:44 PM
That would work great if you only wanted to shoot on 45 degree paths, but most shooters use all 360 degrees. That requires using trigonometry to determine the trajectory of the bullet; there are probably some standard libraries. Have you been following any game development forums at all? The reason I ask is that it is a bit sily to try and reinvent the wheel when there are already people that have done that for you.
http://www.gamedev.net/
http://www.devmaster.net/
http://www.dpfiles.com/
Plug game development forums into your favorite search engine and see what you can find. It only makes sense.
http://www.gamedev.net/
http://www.devmaster.net/
http://www.dpfiles.com/
Plug game development forums into your favorite search engine and see what you can find. It only makes sense.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens
#3
Posted 05 May 2009 - 04:22 PM
Ok, I know you don't like people doing this but could you send me a link to a good tutorial or a VERY simple example, I have found some tutorials on the sites you linked me but I really don't understand them all I have gathered from them are that it involves sin cos etc...thaw about it but not how to implement it.
Thankyou very much for any help, Wolfy87.
Thankyou very much for any help, Wolfy87.
#4
Posted 05 May 2009 - 04:51 PM
I don't know of any good tutorials or simple examples. What you are trying to do requires trigonometry, which is what you found. It may very well take you a few weeks to figure out how to use the resources that you found. Sorry, but that is what programmers do. They define a problem (how to target), see what other people have done (which are the links I gave you), and then they figure out how to use it, which requires effort on your part. Sometimes there are no simple examples, and sometimes it takes a long time to figure out how to do things, and sometimes it means learning other skills. In this case, you may need to spend some tie talking to a math teacher about trigonometry, or spend time with a math book.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens
#5
Posted 05 May 2009 - 06:00 PM
Ok then and if I learn trigg in normal math can I incorporate that into my code? Ie dose it do roughly the same thing.
Thanks for the advice, Wolfy87.
Thanks for the advice, Wolfy87.
#6
Posted 05 May 2009 - 06:05 PM
I don't know what you mean by 'normal' math? Trigonometry is trigonometry, regardless of if you do it with a paper or pencil, or as part of a program.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens
#7
Posted 06 May 2009 - 07:14 AM
Ok, thats sort of what i wanted to know anyway so thanks, off to trigg tutorials
Thanks, Wolfy87.
Thanks, Wolfy87.
Share this topic:
Page 1 of 1

Help




Back to top









