Computer Science Canada Shooting Mechanic Help |
Author: | Zeppelin [ Tue May 20, 2008 12:52 pm ] | ||
Post subject: | Shooting Mechanic Help | ||
I'm making a little overhead GTA clone to refresh my Turing skills. I started with the shooting mechanic but i already have two problems. 1) Is it possible to use a multi button mouse and a keyboard at the same time in Turing and 2) How can i make it so that bullets land anywhere within the area of a circle. Here's the code I have so far. I just started so please ignore the unused variables.
|
Author: | Tony [ Tue May 20, 2008 3:05 pm ] |
Post subject: | Re: Shooting Mechanic Help |
Zeppelin @ Tue May 20, 2008 12:52 pm wrote: Is it possible to use a multi button mouse and a keyboard at the same time in Turing
Yes. Mouse.Where and Input.KeyDown are independent. Zeppelin @ Tue May 20, 2008 12:52 pm wrote: How can i make it so that bullets land anywhere within the area of a circle.
This requires two random variables -- angle (between 0 and 360) and distance from the center (0 to radius). A combination of those two random values will cover the entire area of the circle. |
Author: | Zeppelin [ Tue May 20, 2008 3:30 pm ] |
Post subject: | Re: Shooting Mechanic Help |
Well I've been trying to figure out how to use the angles in the and I'm stumped. I got the distance from centre part but have no clue how to use angles for this. |
Author: | Tony [ Tue May 20, 2008 3:37 pm ] |
Post subject: | RE:Shooting Mechanic Help |
Draw a triangle. If you know the angle and the distance from center, you can figure out the x/y points. Sketch this out on paper. Use basic Trig. |
Author: | Zeppelin [ Tue May 20, 2008 5:40 pm ] |
Post subject: | Re: Shooting Mechanic Help |
I probably sound like an idiot at this point but I just can't figure out how to do this. If someone understands how to do this could you provide an example because I've been trying for 45 minutes to do this and still haven't been able to figure this out. |
Author: | Zeppelin [ Thu May 22, 2008 8:46 pm ] |
Post subject: | Re: Shooting Mechanic Help |
Could someone please provide me with an example of the equasion Tony was talking about. I'm just not that great at understanding things without visuals. EDIT: Nevermind. I asked my friend how to do this so he explained it to me. |