The Daily Click ::. Forums ::. Klik Coding Help ::. Rapid Bullets
 

Post Reply  Post Oekaki 
 

Posted By Message

Aptennap



Registered
  23/04/2004
Points
  916
25th November, 2006 at 10:10:29 -

How can I make 360 degrees rapid bullets using TGF? I tryed some things myself but the things aren't working here's what I now have:

+always
-set globalvalue 2 to dir(bullet)
-set dir(bullet) to lookat mouse

+click left mouse
-create "bullet" at actionpoint(player)
-set dir(bullet) to lookat mouse
-start loop 0 for 1000

+on loop 0
-set x(bullet) to x(bullet)+Sine("Advanced Math object",globalvalue(2))
-set y(bullet) to y(bullet)+Cosine("Advanced Math object",globalvalue(2))

+on loop 0
+(bullet) is out of playarea
-destroy "bullet"
-stop loop 0

Please help.

 
Oh sweet mary.

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
25th November, 2006 at 10:21:27 -

You have way too many loops in your fastloop, your code is putting the bullet off the screen before it's seen.

Some other of your events don't make sense either, surely you want to set global value 2 to the direction value after you change it's direction?

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
25th November, 2006 at 10:34:16 -

And why are you using the standard 32-dir system, if you're trying to make a 360 degree shooting system (line 3)? I also think the first line should be:

+on loop 0
-set globalvalue 2 to dir(bullet)
-set dir(bullet) to lookat mouse

I'd make an example file, but I haven't got extensions to work on my TGF.

 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
25th November, 2006 at 11:21:29 -

Yes, right now you are using direction 1-32 in a sin/cos function. Sin/cos functions on 1-360.

So you are only shooting in the first 32 degrees of a circle, is your problem. And also, your decimal offset is probably fairly high. I recommend setting it to ^3 at the start of frame events, and dividing each sin/cos function by 1000.


If you want to use 32 direction "rapid bullets", use the direction calculator instead of the advanced math object; instead of setting to sin/cos of a generic angle, have each bullet set to its directional offset from the calculator in each loop.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Aptennap



Registered
  23/04/2004
Points
  916
25th November, 2006 at 12:06:35 -

I'd really like to have 360 degrees, i wish someone could make an example file. I could use the MMF demo to open it perhaps?

 
Oh sweet mary.
   

Post Reply



 



Advertisement

Worth A Click