Project Starfield, Xna game
Loading...
13,430
Loading...
Uploader Comments (SimonAJager)
see all
All Comments (32)
-
@SimonAJager Thank you so much for your reply I'll do as you suggested and research cosine and sine. The one difference with my program is that the character is free moving, and can fire in any direction (using 360 controller). I'll just have to figure out how to apply this to my game, but it shouldn't be too simple, probably taking the x and y of the joystick and converting it to radians.
-
Very good job!
-
nice.
simple but cool :)
-
@SimonAJager your welcome! thanks a lot!, you can watch some basic particles in my account.. i made they.. but they are a little bit old.. xD
Loading...
I have a few questions if you don't mind me asking? How did you get your bullets in all directions to go the same speed? I just started making an XNA game and have had some issues with this, also, how did you get your firing working in all directions? If you want to PM me, I can send you my coding thus far so maybe you could see what I'm doing wrong.
foulplay2 8 months ago
@foulplay2 Absolutely. The trick was to use Cosine and Sinus to calculate the trajectory of all the bullets. This was something I didn't have much understanding of when I did this, though now I do - Learning by doing that is.
I would recommend that you look up trigonometric functions to learn how Cosine and Sinus works - if you dont already that is. You can find these under the "Math" class. (Math.Cosine(rotation)) for instance.
SimonAJager 8 months ago
@foulplay2 Here is away of calculating a bullets speed. Though I'll be doing this straight from my head so there might be some spelling issues or something like that.
Vector2 bulletLocation = Vector.Zero;
float bulletSpeed = 5f;
Vector2 bulletTrajectory = new Vector2(bulletSpeed, bulletSpeed) *
new Vector2(Math.Cos(firingRotation), Math.Sin(firingRotation));
And then multiply the bulletLocation with the bulletTrajectory every frame. Hope this helps abit.
SimonAJager 8 months ago
@foulplay2 You might have to throw rotation that you pass into the Math.Cos and Math.Sin functions to radians or degrees. Not sure which one it wants. You can do this by using the "MathHelper" class. For Instance. MathHelper.ToRadians(firingRotation);
SimonAJager 8 months ago
so nice man! i like the particles (;
what is this song? i love it! ^.^
Grinchok 11 months ago
@Grinchok Haha thank you! The song is Database - Alexander Perls my friend :).
SimonAJager 11 months ago