The Daily Click ::. Forums ::. Klik Coding Help ::. Back to the aiming system again.
 

Post Reply  Post Oekaki 
 

Posted By Message

Deleted User
11th January, 2009 at 23:28:48 -

Okay, I've got somewhat of the desired effect I'm looking for, but It needs something else. There were two examples I've been using that are posted below, but I need something else to work with them. The first one uses fastloops to automatically set the target to the maximum distace around the player, which I don't like, but it slides nicely around obsticles. The second one allows the player to move the cursor back and fourth (which is a MUST for this kind of game, as it's not only used as a combative coursor). And it uses the standard distance and angle algorithms. I want to incorporate it by maybe puting the algorithm in a fast loop but it only goes as many times as the distance or something and whatever, BUT I'm racking my brain on this one, so maybe someone with more expirience can have a go at it. I like where it's currently at which is almost a carbon copy of the second one, except it uses a variable system to figure the max distances, but I don't want the player to be able to move the coursor through obsticles. I'm using MMF2.

http://www.mediafire.com/file/dqlxhhzmzfn/Aiming.mfa

http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Aiming.mfa

Edited by an Administrator

 

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
12th January, 2009 at 18:56:13 -

Open up the first of those two files (the one I didn't make).

In the first line where it says "start loop "aim", 100 times", replace "100" with this;

Max(Min(Sqr(((X( "Player" )-XMouse) pow 2)+((Y( "Player" )-YMouse) pow 2)), 100), 30)

Change where it says "30" and "100" to change the minimum and maximum ranges respectively (I seem to remember you needed a minimum range for some reason). If not, just use;

Min(Sqr(((X( "Player" )-XMouse) pow 2)+((Y( "Player" )-YMouse) pow 2)), 100)

 
n/a

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
12th January, 2009 at 21:56:28 -

Thanks for that, sketchy

I did update that I think (but forgot to upload it), so it would only run the loop the amount of pixels between the mouse and the player but my calculation was a bit different. I like yours better because it seems simpler and it's finally taught me what the "Min" and "Max" functions do\how to use them. I'll definately be using them from now on! Thankyou Sketchy!

 
n/a ...

Deleted User
12th January, 2009 at 23:28:58 -

I killed my computer. I'll try it once I get a new one, but that's probably not going to be for a while.

 

Deleted User
13th January, 2009 at 03:08:47 -

Jup, that did the trick. Thanks again!

 
   

Post Reply



 



Advertisement

Worth A Click