Posted By
|
Message
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 09:39:34 -
Can someone tell me how to make a 32 directions rapid bullets engine in TGF?
Oh sweet mary.
|
Nuutti
Registered 26/10/2003
Points 1364
|
6th December, 2006 at 12:23:24 -
sooda.dy.fi/~nuutti/jotainmuuta/rapid_32_bullets.gam
that's a rough example, there are some things that you should fix if you want a perfect thing.
P.S. sorry for my mangled english.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 12:31:44 -
Thanks, its perfect, really good.
Oh sweet mary.
|
Dustin Gunn Gnarly Tubular Way Cool Awesome Groovy Mondo
Registered 15/12/2004
Points 2659
|
6th December, 2006 at 12:35:08 -
You really should have 360 directions for bullets if it's free aiming. It's dead simple:
Set X Position to X Position + Cos(Angle 0-359) * speed
Set Y Position to Y Position - Sin(Angle 0-359) * speed
n/a
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 12:56:11 -
Yes but TGF cant handle angles only 32 directions
Oh sweet mary.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 12:58:25 -
I tweaked the example a bit : http://www.freewebs.com/appien1/rapid_32_bullets.gam how can i do that you cant see the bullets when they are overlapping the player when they are created?
Oh sweet mary.
|
Nuutti
Registered 26/10/2003
Points 1364
|
6th December, 2006 at 13:35:37 -
..You could actually do it so that it has 360 degrees, just do it with that advanced maths object.
P.S. sorry for my mangled english.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 13:55:28 -
Please tell me how to do that, please...
Oh sweet mary.
|
Nuutti
Registered 26/10/2003
Points 1364
|
6th December, 2006 at 13:58:33 -
i'll try to explain...
In that example i made there was like:
always: -set alterable value a to direction*(360/32).
This time you don't do that, just set alterable value a to the angle you want it to be. You can do like when pressing a key the player turns a few degrees. Or you can do it mouse-aimed but for that you'll need some other functions and i don't know if they are in tgf.
P.S. sorry for my mangled english.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 14:24:34 -
Mmm sounds hard, is it possible to calculate the angle from the position of the player and the mouse cursor or so?
Oh sweet mary.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 14:36:40 -
Oke I got it it can easily be calculated with Advanced Math Object.
Oh sweet mary.
|
Nuutti
Registered 26/10/2003
Points 1364
|
6th December, 2006 at 14:41:08 -
Yes the angle between 2 coordinates can be calculated with atan or, more easily with atan2, and some extensions have a function for that. I don't remember is it like direction calculator or advanced maths extension or what ever. Anyway, good if it works now.
P.S. sorry for my mangled english.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 15:22:23 -
Still doesn't work,were can i get atan2?
Oh sweet mary.
|
Aptennap
Registered 23/04/2004
Points 916
|
6th December, 2006 at 15:57:00 -
I now have this : http://www.freewebs.com/appien1/rapid_32_bullets.gam But it still doesn't work.
Oh sweet mary.
|
Joe.H Evil Faker
Registered 19/08/2002
Points 3305
|
6th December, 2006 at 18:09:03 -
Angle between two points:
(x1,y1) and (x2,y2)
is
atan((y2-y1)/(x2-x1))
My signature is never too big!!!
|
|
|