User Tag List

Results 1 to 8 of 8

Thread: Creating Objects Randomly In the Frame

  1. #1
    No Products Registered

    Join Date
    Aug 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Objects Randomly In the Frame

    How do I create an object randomly in the play area? I'm trying to make monsters come out of the ground every 5 seconds, but I only know how to select the spot. I'm sure there's a way.
    Any help?

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Creating Objects Randomly In the Frame

    Create the object off-frame, then set the X and Y to random(640) and random(480) or whatever.
    .:::.Joshtek.:::.

  3. #3
    No Products Registered

    Join Date
    Aug 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Objects Randomly In the Frame

    For some reason its not working. What should the main event be?
    I have it like this:

    Every 5 seconds/Number of "Monster" >6
    and then creates the monster outside the frame. Something isn't working.

  4. #4
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Creating Objects Randomly In the Frame

    Maybe you should do < 6 instead?

    Remember, the set position actions must occur after the create object action.
    .:::.Joshtek.:::.

  5. #5
    No Products Registered

    Join Date
    Aug 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Objects Randomly In the Frame

    Ok I figured something out. Thanx

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Objects Randomly In the Frame

    Ok, guess you figured it out when I wrote this <img src="/center/images/graemlins/smile.gif" alt="" />

    What Joshtek said shouldn't need much more explanation, but here's a little detailed example for you.

    number of "Monster" is less than 6
    every 5.0 sec
    create "Monster" at (-50,-50)

    "Monster" is out of playarea
    set X position of "Monster" to 40 + random (560)
    set Y position of "Monster" to 40 + random(400)

    The fixed pixels are there to prevent the monsters from beeing created near the edge of the screen

    This should do it.

    When you get this to work, you should add another condition to test if two monsters are overlapping, and move one of them to another spot.

  7. #7
    No Products Registered

    Join Date
    Aug 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Objects Randomly In the Frame

    Ok thanx, that seemed to work. The only problem left now is the monsters appear throughout the whole stage. How would I get them to appear ONLY near the hero no matter where he is in the stage?

  8. #8
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Objects Randomly In the Frame

    This will make the monsters appear around the hero.
    set X position of "Monster" to X position of "Hero" - 100 + random(200)
    set Y position of "Monster" to Y position of "Hero" - 100 + random(200)

    EDIT: this could eventually make them appear out of the frame if the hero gets close to the edge. Alternatively you could make an invisible big sphere object that is always placed at the player's position. Then create "spawnpoint" objects throughout the level (that are invisible too). Now if the sphere overlaps a spawnpoint, select a random spawnpoint and create a monster there. This will prevent them from appearing in obstacles or out of the screen etc, and you can make places in the level where no monsters spawn etc. More control for the level designer.

    Besides, Popcorn, instead of "every 5.0 sec" he should use "restrict actions for 5.0 seconds". This is basically the condition equivalent to the "every x seconds" triggered condition. Which means it doesn't need to be at the top of the event to work. Only side effect is that it happens first, and the every 5 seconds instead of in 5 seconds and then every 5 seconds.

Similar Threads

  1. Help. Problem bringing in objects randomly at start of frame
    By GregK in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 14th October 2013, 04:33 PM
  2. Box2D objects disappearing randomly
    By SolarB in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th July 2012, 08:01 PM
  3. Randomly Generating Active Objects
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 3rd June 2012, 09:35 AM
  4. Background objects disappear randomly
    By TonyHayes in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 1st January 2012, 07:05 PM
  5. Randomly choosing two objects example for beannie
    By Brandon in forum File Archive
    Replies: 1
    Last Post: 9th November 2007, 10:22 AM

Posting Permissions

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