User Tag List

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

Thread: Crosshair from Gun

  1. #1
    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)

    Crosshair from Gun

    OK so I have a platformer game I'm making where I want the firearms to display a crosshair where the bullets are generally going to hit. (They hit instantly) How do I make the crosshair display instantly across any amount of space on obstacles and entities and whatnot without using fastloops or pasting the same code 480 times? I'm going to use the XNA exporter in the end so keep that in mind if you're going to suggest an extension.

    I could use fastloops, but then I'd need 480 iterations since the width of the screen is 480 and this causes slow down when I run 480 loops, regardless of whether it's applied to events or not.

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Shoot another fake invisible bullet all the time that hits instantly and when that bullet overlaps an obstacle/entity then position the crosshair at that bullet's location.

  3. #3
    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)
    I got the idea just now to use the platform movement object itself to move stuff instantly since you can set its speed to some ridiculous amount like 20,000 and it still detects things near perfectly and it works like a charm.

  4. #4
    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)
    I was able to use fastloops with only 49 iterations alongside 10 iterations by making the 49 iterations move the crosshair object 10 pixels at a time and then the 10 iterations moving the object back 1 pixel if it overlaps anything. It's not what I would like to do but it works. Unless someone knows something better, I guess I'll go with this.

  5. #5
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    What's wrong with my suggestion?

  6. #6
    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 Konidias View Post
    What's wrong with my suggestion?
    With the method you described i can identify a lag ( the time it takes for the Invissible bullet to reach the Obstacle ).

    ...
    I do have a nice method in mind, and i just might make an example illustrating it too

  7. #7
    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)
    Quote Originally Posted by Konidias View Post
    What's wrong with my suggestion?
    There would be a lag like King_Cool pointed out and also an inaccuracy in detecting obstacles and other objects.

    Quote Originally Posted by King_Cool View Post
    With the method you described i can identify a lag ( the time it takes for the Invissible bullet to reach the Obstacle ).

    ...
    I do have a nice method in mind, and i just might make an example illustrating it too

    I would like to see your example. I got it to work fine with the 49 + 10 iterations, but if you've got a more efficient method, by all means share it.

  8. #8
    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)
    Here it is.
    Its accurate, but seems to lag quite a bit for long distances though.

    How does your method work?
    Does it lag?
    Attached files Attached files

  9. #9
    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)
    Here is a much faster version.
    Attached files Attached files

  10. #10
    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)
    My method just moves a dummy object across the screen 10 pixels per iteration with 49 iterations to cover 480 pixels of distance, then when it collides with an object it initiates a fastloop with 10 iterations to move the dummy object back up to 10 pixels to give the illusion of pixel perfect accuracy, then it sets the crosshair to the dummy object's coordinates.

Page 1 of 2 1 2 LastLast

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
  •