The Daily Click ::. Forums ::. Klik Coding Help ::. Turret Aiming w/ Mouse
 

Post Reply  Post Oekaki 
 

Posted By Message

Corsair



Registered
  26/06/2004
Points
  16
24th April, 2005 at 21:59:00 -

While using mouse aiming in a top-down 360-degree shooter, say the player is a tank, is it possible to have the turret aim using the mouse, but track slower?

Ie the player moves the moves quickly acorss teh screen, but it takes teh turret of teh tank a few seconds to catch up.

 
Don't knock on death's door- ring the doorbell and run away. He hates that.

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
24th April, 2005 at 22:44:33 -

Yes.

 
n/a

Corsair



Registered
  26/06/2004
Points
  16
24th April, 2005 at 23:24:48 -

OKay - then I'll rephrase my question - could someone tell me how to have the turret aim using the mouse, but track slower?



 
Don't knock on death's door- ring the doorbell and run away. He hates that.

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
24th April, 2005 at 23:35:44 -

Oh, right.

Always
--Turret value A = [angle to mouse]
--Turret: Set direction to Value B

Every 00"-05
+Turret Value B < Turret Value A
--Turret: Add 1 to Value B

Every 00"-05
+Turret Value B > Turret Value A
--Turret: Subtract 1 from Value B

 
n/a

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
25th April, 2005 at 15:05:52 -

Surely that'll get messed up when value A is 350 and value B is 5, for example? It'll think it has to turn 345 degrees one way, when in reality it only needs to go 15 degrees in the other direction.

 
n/a

Long John Kickbag



Registered
  26/08/2002
Points
  148
25th April, 2005 at 15:06:58 -

It won't work properly all the time if you do that (like if the direction you want is 10 degrees and the current direction is 350). You need to get the two directions within half a full rotation of each other. You can do that by fixing one angle at 180 degrees (add the difference between 180 and the first angle to the second angle) then making sure the remaining angle is within 360 and 0 (add 360 and then mod by 360). In MMF that's something like:

(Angle2+540-Angle1) mod 360

(Which you then compare to 180.) Alternatively you could use an extension (I think the Angle Calculator can do it).

 
Resize! - www.clicksplat.com/comparison.html

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
25th April, 2005 at 21:10:17 -

Obviously that was an off-the-cuff example, it would only take a couple more triggers to work in full 360, but I was actually thinking of a side-view turret that wouldn't be able to rotate a full 360 and therefore wouldn't have to go through itself.

I know he said top-down. Shut up.

 
n/a

-Vinny-



Registered
  12/01/2005
Points
  436
25th April, 2005 at 22:22:42 -

ok first of all - DON'T USED TIMER EVENTS!!! - they just aren't reliable

corsair, check your pm, i've sent you a msg

 
Vinny

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
25th April, 2005 at 22:25:13 -

Timed events are fine for non-critical stuff, especially usuing small increments. Nobody's going to notice a .001 fluctuation on a .05 second event.

 
n/a

-Vinny-



Registered
  12/01/2005
Points
  436
25th April, 2005 at 22:31:16 -

ok well, i'm not totally sure about that radix, you may be right, but i'm jsut saying, it's better safe than sorry, am i right? either way, whatever works for you is fine, as long as you are satisfied with it

 
Vinny

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
25th April, 2005 at 23:05:22 -

No, you're wrong. And you'll continue to be if you just parrot crap like that as you've been doing.

 
n/a

-Vinny-



Registered
  12/01/2005
Points
  436
26th April, 2005 at 04:45:52 -

that's awesome! thx for your comment on that radix, that's exactly why i don't come to these forums much, like, i don't mind spammers to a degree, but being just plain rude is worse than crap

 
Vinny

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
26th April, 2005 at 06:42:46 -

Sensation: I agree, you shouldn't visit forums where people don't put up with bullshit if you're you.

 
n/a

Corsair



Registered
  26/06/2004
Points
  16
26th April, 2005 at 17:43:27 -

Thanks for the quick replies, I'll test that out and see how it works for me.

And Radix, While I most certainly appreciate your input, is it really all that neccessary to belittle people like that ? C'mon, I'm sure you can be a little more mature than that.

Image Edited by the Author.

 
Don't knock on death's door- ring the doorbell and run away. He hates that.

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
26th April, 2005 at 19:37:40 -

btw. he's not wrong, but it's a tremendous waste of precious resources (both object count and time).


So yeah, he's pretty much wrong.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click