The Daily Click ::. Forums ::. Klik Coding Help ::. 360 degree aiming/shooting. How to use fastloops for bullet speed?
 

Post Reply  Post Oekaki 
 

Posted By Message

Smirnoff



Registered
  14/05/2009
Points
  356

VIP MemberI am an April Fool
22nd August, 2009 at 08:51:58 -

Right now I have the system implemented using someone's example, I forgot who's. Anyway, it uses a value for speed and two values for accuracy. The only problem with this system is that the bullets will often pass through their targets. I need more precision but I am new to fastloops, still.

The bullet's movement is handled this way:

Always
-Add (Cos(Angle( "Pistol Bullet" ))*10)+Randomdir( "Pistol Bullet" ) to Xmove
-Add ((Sin(Angle( "Pistol Bullet" ))*(10*-1))+Randomdir2( "Pistol Bullet" )) to Ymove
-Set X(of bullet) to Xmove( "Pistol Bullet" )
-Set Y(of bullet) to Ymove( "Pistol Bullet" )

Please help.

 
Image

Hagar

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1692

You've Been Circy'd!Teddy Bear
22nd August, 2009 at 12:32:36 -

Look up the move safely extension.

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
22nd August, 2009 at 14:21:37 -

Heh, there's a few problems there:
1. Your cosines and sines look like they're being stored in integers. So, instead of 0.218*10.. it becomes 0*10. To avoid this probably, use Add (0.0 + Cos(angle("PistolBullet"))*10) + ...
2. Your object is moving by a few pixels every time, which is why they're passing through the target. Like Hagar said, that's what the Move Safely object helps with.

If you want to use a fastloop, just replace "always" with "loop: (loopname)", then run loopname as many time as you want to speed up.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Smirnoff



Registered
  14/05/2009
Points
  356

VIP MemberI am an April Fool
22nd August, 2009 at 19:37:34 -

How do I use the move safely object? I could not find an example file and the article posted here is somewhat incomplete.

 
Image
   

Post Reply



 



Advertisement

Worth A Click