User Tag List

Results 1 to 4 of 4

Thread: Fastloop bullets example

  1. #1
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fastloop bullets example

    This example uses fastloops to move objects across the screen, so that they can be stopped instantly when they collide with an obstacle without having to pull them out of walls.

    It does this by spreading a value in alterable value A of the bullet object, then looping through each of them individually. Each bullet object is moved forward a pixel at a time to a maximum of ten until it can't move any further. The general idea in pseudocode:

    Code:
    For each bullet on the screen: {
         Up to a maximum of 10 times: {
              Move the bullet 1 pixel forward.
              If the bullet is now overlapping an obstacle: {
                   Move it back.
                   Don't try to move it any further.
              }
         }
    }
    This could be made more efficient by actually destroying the bullets when they're not moving, but they're left here to show that they don't move into the backdrops.

    Increase the amount of loops of the "bullet" loop to about 1000 to get "hitscan", or instant-hit bullets.
    Attached files Attached files

  2. #2
    No Products Registered

    Join Date
    Jul 2006
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Fastloop bullets example

    Thats a cool little example. However it makes it a lot more efficient if you do it like this (attachment). (Hold space for a constant stream of objects)
    Attached files Attached files

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Fastloop bullets example

    You're right, actually - I'm sure there was a reason I did it with the nested loops at first, but I can't see any problem with that way.

  4. #4
    No Products Registered

    Join Date
    Jul 2006
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Fastloop bullets example

    I think it's faster because instead of coding nested loops in MMF you are utilising the hard wired loops built into the MMF engine to select each object.

Similar Threads

  1. Ring of bullets
    By Windybeard in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th March 2013, 04:35 PM
  2. FPS and Bullets Compromise
    By RealGameMaker in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 29th November 2009, 11:49 PM
  3. What movement type is best for bullets?
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 3rd April 2008, 04:53 AM
  4. Programming bullets
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 12th June 2007, 10:43 PM
  5. Bullets Going Through Walls?
    By Brandon in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 29th December 2006, 11:10 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
  •