User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15

Thread: Crosshair from Gun

  1. #11
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My method draws a line from Player to Mouse.
    If the Line is overlapping and Obstacle, 2 fastLoops are triggered in this order:

    FAST LOOP A
    - Halves the length of the line untill Line is no longer overlapping Backdrop ( also stores the length halved )
    - If Line is no longer overlapping Backdrop, the Line is increased by 1/10 of the last line halving
    - As the line is increased and overlapps a backdroop, the line is reduced by 1/10 of the last line halving, and the loop ends

    FAST LOOP B
    - This loop simply increases the Line length by 1 untill it hits an Obstacle, in wich case the Line is reduced by 1 and the loop ends

    ...
    The idea behind this is to get as close to the Obstacles as possible by using big steps before starting to fine tune by moving 1 pixel at a time.
    Ill uppload a new example wich has a counter displayong exactly how many loop ( accounting for both loops ) iterations are run for each execution.

    If you stay inside the Frame the number of loops run is about 2 - 20 for each execution, but if you start moving outside the frame however the number of iterations increase.
    Attached files Attached files

  2. #12
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah my method works in a similar fashion but I'll use your example probably for the fourth weapon I hadn't designed yet, making it have a laser pointer-type aim instead of a crosshair. Thanks.

  3. #13
    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)
    King_Cool, why are you increasing the line by 1/10 when it is no longer overlapping an obstacle? It'd be faster and more efficient to increase by 1/2 still. That particular method of obstacle detection is called a Binary Search, which I believe is the most efficient method.

  4. #14
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jacob View Post
    King_Cool, why are you increasing the line by 1/10 when it is no longer overlapping an obstacle? It'd be faster and more efficient to increase by 1/2 still. That particular method of obstacle detection is called a Binary Search, which I believe is the most efficient method.
    Thanks, i didnt know this was called binary search
    Jacob, I just tried your suggestion wich is not faster. The method yireld 3 - 5 times as many fast loops per execution.

    I can explain in detail and provide examples if you want.

  5. #15
    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)
    You must be doing something wrong. Imagine you are at the ordinate 35 and want to get to 194

    Add 256 -> 291

    291 is over 194, so subtraction is required
    Subtract 128 -> 163

    163 is less than 194, so addition is required
    Add 64 -> 227

    Subtract 32 -> 195
    Subtract 16 -> 179
    Add 8 -> 187
    Add 4 -> 191
    Add 2 -> 193
    Add 1 -> 194

    Required 8 operations to solve. This will work for any number within 256 (2^8) from the origin. In 9 moves, there is a range of +-512 (2^9)

    There is no possible way your search algorithm could get an accurate result in 1 to 3 loops, so I'm not sure what you mean by mine causing 3-5 times as many loops.

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Rotate crosshair around player
    By Yikes in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th December 2011, 06:45 PM
  2. move away from crosshair
    By nick_Peoples in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 27th July 2011, 01:04 AM
  3. Moving crosshair example for willow
    By Nick in forum File Archive
    Replies: 3
    Last Post: 21st December 2009, 10:12 PM
  4. Crosshair and player
    By hawk1281 in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 21st August 2009, 05:02 PM
  5. Crosshair positioning
    By PengeyPenguin in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 8th August 2009, 08:03 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
  •