User Tag List

Results 1 to 2 of 2

Thread: Sniper Dot - Line of sight, or something.

  1. #1
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ACESpark's Avatar
    Join Date
    Oct 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sniper Dot - Line of sight, or something.

    Jeeze, I feel like a real newbie for posting this, but i'm stumped with something.

    Basically, i'm making a top down view shoot em up, and one of the weapons is to be the Sniper rifle.
    This will basically place a target icon at what-ever target is directly in front of you, closest. (the idea being that pinpoint shots kill enemies instantly while misses do little damage, sort of thing.)

    I'm having trouble getting the "dot" to work.
    Say if an enemy is directly in front of you, I want the dot to appear on that enemy.

    At the moment the dot moves about too much if you move about. (i.e appears inside the wall, misses the target, etc.)

    I've tried making the player continually spawn and shoot objects (when they hit anything set dot to that object, etc) but clearly that isn't working too well.

    Any ideas? I'm stumped. Go me for sounding like a real newbie, i've only been using click products since Klick and Play was first released .

  2. #2
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Sniper Dot - Line of sight, or something.

    Use fast loops and trigonometry.

    Always
    Startloop "dot"
    On loop "dot"
    Dot is not overlapping an obstacle (or any enemies)
    Add 1 to distance (distance can be a counter, or a global value, or whatever)
    Set Dot's X coordinate to X of player + (Cos(angle of player)* distance
    Set Dot's Y coordinate to Y of player + (Sin(angle of player)* distance

    You may have to fool around with the formulas a bit, like use a - instead of a plus, or do a 360-angle if it is going the wrong way.

Similar Threads

  1. Line of sight
    By JosephFTaylor in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 15th June 2012, 05:12 PM
  2. Line of Sight example
    By Ryan in forum File Archive
    Replies: 4
    Last Post: 30th August 2010, 05:27 AM
  3. line of sight
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 19
    Last Post: 14th July 2010, 06:10 PM
  4. Line of Sight
    By Uzalu in forum Extension Development
    Replies: 1
    Last Post: 5th December 2009, 10:52 PM

Posting Permissions

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