User Tag List

Results 1 to 8 of 8

Thread: How do we make a random spawner?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do we make a random spawner?

    Hi, I would like to know how to make a random spawner with 2 objects that wont overlap each other when randomly spawned from top of screen?
    Thanks in advance!

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Marv has several examples on his site for this.
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what would the example names be called on marv's site?

  4. #4
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS 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)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    1,037
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    this is 1 way of doing it;

    OBJECT to be spawned - > have a flag to see to position & flag to check if OK
    flag0=0 means positioned onscreen and is overlap another object; flag0=1 means positioned onscreen and is clear
    flag1=0 means this object has not been placed, flag1=1 means it is finally placed on screen

    1. create an OBJECT, @ -50,-50 (outside of play area)
    2. OBJECT.flag1 = 0, set positionX to random(width), set positionY to random(height)
    3. OBJECT.flag0 = 0 & OBJECT X[NOT]overlapping OBJECT, set flag0 to 1
    4. OBJECT.flag0 = 1, set flag1 to 1

    If the OBJECT is on screen in random position and clear, both flag0=1 & flag1=1
    the object will be moved around until it is clear of any objects (this will happen very fast - you shouldnt notice unless you dont have many clear places left on screen)

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    BiznessMan's Avatar
    Join Date
    Apr 2007
    Location
    Sandy UT
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The way I did it was I copy/pasted a spawn object in different places in my frame. Then on the spawn event I added a subevent of Object > Pick or Count > Pick (Object) at Random and then had the enemy spawn on that object.
    During runtime it will select one of the spawn points at random and spawn the enemy ontop of it

  6. #6
    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)
    A simple method I used for a game where tons of stuff drops from the top of the screen and comes straight down the screen:

    Make an active object and set the width to the width of the objects you want to spawn. Then set the height to the entire height of your screen plus the height of the spawn area at the top of the screen. Then just fill it in with a solid color. So now your spawner object should just be this long vertical rectangle.

    Then you can randomly set it's X position and create your spawned objects relative to the X of that spawner object. To make sure that only one object spawns in that x row, you would then just check if your spawner object is overlapping any spawned objects. Since the spawner object runs the entire length of your screen, it will ensure that the spawner will only spawn something in an empty row.

    Finally you'd set the spawner object to invisible so it's not seen in the game.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it possible for someone to show me an example of this?

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module
    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)
    rndpro's Avatar
    Join Date
    Sep 2012
    Location
    England, UK
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want an easier way to do this without me mentioning values and coding, try create an object above the play area and have it move left and right between the frame width. At random times (if this object is not already overlapping a spawned object) spawn an object. You could also set a time between spawns as the level gets harder so what ever the spawner object time is increased to, when it hits that time spawn another object.

Similar Threads

  1. Random Active Spawn in Random Location in Frame
    By Top_of_the_Temple in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th October 2016, 03:33 AM
  2. How to make a random spawner?
    By UnicornMan in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 20th December 2013, 04:13 AM
  3. Make Random Pool not-so-random?
    By UltraHammer in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 4th April 2013, 02:53 PM
  4. [ASK] How to make animation and random objects
    By L13n in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 2nd November 2012, 11:19 AM
  5. How do I make random movements?
    By The Thinker in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 4th December 2006, 09:48 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
  •