The Daily Click ::. Forums ::. Klik Coding Help ::. 32 direction rapid bullets
 

Post Reply  Post Oekaki 
 

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

Game of the Week WinnerKlikCast StarVIP MemberI'm on a BoatGOTW Winner Oct 2010Kliktober Special Award Tag
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!!!

Aptennap



Registered
  23/04/2004
Points
  916
7th December, 2006 at 01:29:51 -

atan? Is that in a extension?

 
Oh sweet mary.

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
7th December, 2006 at 07:48:29 -

atan is the inverse of tan.

If TGF doesnt have it, you may need the advanced math object, or something.

 
My signature is never too big!!!

Nuutti



Registered
  26/10/2003
Points
  1364
7th December, 2006 at 11:02:01 -

If you do it with atan, you'll need to modify the result by adding 180 to it in some circumstances and such. If some extension includes atan2 I recommend that one.

 
P.S. sorry for my mangled english.

Aptennap



Registered
  23/04/2004
Points
  916
7th December, 2006 at 11:38:15 -

Umm..can someone please make an example?

 
Oh sweet mary.

JohnLastrologue



Registered
  09/06/2005
Points
  247
7th December, 2006 at 13:14:36 -

I once made a complete engine of a 360 directions bullet... it has flaws but I'm too lazy to perfect it. It's in french but you should figure your way around it. If you absolutely need a translation I might see what I can do for you...

http://johnwof.site.voila.fr/moteur360.rar

 
n/a

Nuutti



Registered
  26/10/2003
Points
  1364
7th December, 2006 at 13:45:38 -

http://sooda.dy.fi/~nuutti/jotainmuuta/rapid_32_bullets.gam
i did one too, i am not sure how perfect it is. it has 360 degree shooting now.
hmm, the file still has the name rapid 32 bullets, though it's not 32 directions anymore, it's 360 degrees.

Image Edited by the Author.

 
P.S. sorry for my mangled english.

Aptennap



Registered
  23/04/2004
Points
  916
7th December, 2006 at 15:15:32 -

Wow Thanks both of you they are both really good.

 
Oh sweet mary.

Aptennap



Registered
  23/04/2004
Points
  916
29th December, 2006 at 15:34:29 -

Oke i implented the 360 shooting thing, and it works fine but now i need to create a machine gun and a shotgun, how can i create these using the 360 shooting system (machine shoots less acurate and the shotgun shoots 2 or 3 bullets in different directions) I really dont know how to do this, please help.

 
Oh sweet mary.

Aptennap



Registered
  23/04/2004
Points
  916
30th December, 2006 at 10:22:37 -

Oke i got the machine gun thing working now, bút i cant get a shotgun thing.
UPDATE: Nevermind i got everything working now!

Image Edited by the Author.

 
Oh sweet mary.
   

Post Reply



 



Advertisement

Worth A Click