User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Rotating towards target?

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rotating towards target?

    I want my tanks gun to rotate towards the main character when the main character gets near.

    a)how can I get the the gun to rotate to the main character and STOP SO IT CAN FIRE (I got it to rotate by adding one to the Direction every second)

    b)how do I get a zone around the tank to detect if the main character is within range?

  2. #2
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    I would just make it so when ever you want your tanks gun to rotate to your character, set a counter to 1
    Then every 1 second while that counter equals 1, add one to the direction and every like 6 or so seconds(how long you want it to be before it shoots) and the counter equals 1, fire, then set counter back to 0

    So it would be something like this:
    *(Whatever triggers the tank to move its gun)
    -Set counter to 1

    *Every 1 seconds
    +Counter equals 1
    -Add one to direction of gun

    *Every x seconds
    +Counter equals 1
    -Fire
    -Set counter to 0

    There probably is a better way but this is probably the easiest.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    Yeah but how do I get the gun to shoot only when it has a lock? I got it to rotate already if you saw what was in parentheses in the a) section.

    Heres what I'm doing to give you an idea:
    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=91036#Post91036

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    make a big circle that is invisible and centers on the tank. Then test if the player collides with the circle to make the gun aim.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    Um... did you look at what I uploaded (I already got the "zone")? What I am trying to do is get the gun to ROTATE to the main character to give the main character some time to run. And I've got your circle as a box, I just can't event:
    When direction of gun is facing main character
    -shoot

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    Always shoot an object, and when that collides with the player, shoot the bullet.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    But I want it only to shoot when it has a lock, meaning when its facing the main character - look at what i have in the file archives please

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Jun 2007
    Location
    Suffolk, UK
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    I would probably use the advanced direction object (Direction Calculator is another option) because you'll be able to do the rotating a lot easier and with much less code.
    For the shooting when you've got a lock, you could compare the direction of the gun with the direction from the gun to the player and if they match then fire

  9. #9
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    how do i get the direction of the gun to the player?

  10. #10
    Clicker Multimedia Fusion 2

    Join Date
    Jun 2007
    Location
    Suffolk, UK
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating towards target?

    If using the Advanced Direction Object:
    LongDir( "Advanced Direction Object", X( "Gun" ), Y( "Gun" ), X( "Player" ), Y( "Player" ))

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Deployment Target
    By phanchingchong in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 15th October 2012, 05:45 PM
  2. Accelerate to target
    By SolarB in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 22nd July 2012, 03:03 AM
  3. X += (target - X) * .1
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 25
    Last Post: 10th June 2012, 11:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •