User Tag List

Results 1 to 5 of 5

Thread: Create a random object from set

  1. #1
    invicticide
    Guest

    Create a random object from set

    Hey all, I am very new. I installed like an hour ago, went through the tutorial and all that jazz. Now I'm trying out some new ideas.

    I've created a set of five objects (blocks of different colors) to use as templates. What I want to do is, every few seconds, pick one of the blocks at random, and spawn a copy of it into the playing field.

    So far all I've found is the Create Object action which as far as I can tell requires me to specify a specific object type to create.

    I theorize that I could make a big mess of conditions to do it:

    - IF timer > 2s AND random_number == 1 THEN create red block
    - OR IF timer > 2s AND random_number == 2 THEN create blue block
    - etc...

    But I wonder if there's a cleaner way? I see that I can do a condition "pick a random object" which seems like a good starting point, but I don't see where I can go from here. :P

  2. #2
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Create a random object from set

    The "Create new object" is limited i many ways sadly.

    I think you have to look at some code like this (as you said yourself):

    Every 2 sec:
    -> Set counter "blah" to random(3)

    Every 2 sec:
    + Value("blah") equals to 0
    ---> Create object 1

    Every 2 sec:
    + Value("blah") equals to 1
    ---> Create object 2

    Every 2 sec:
    + Value("blah") equals to 2
    ---> Create object 3

    You could probably suggest a feature so Qualifiers appear in the 'Create new object' dialog so it will randomly pick one object from the objects belonging to the qualifier (your set). That would be a handy feature and would reduce the above code to only one event.

  3. #3
    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: Create a random object from set

    One thing you can do, since you only want to make static blocks, is to have all the blocks stored as an animation in one Active object. Then, when you want mmf to create a random block, just create the Active object, set its animation to random(number of animations) and use the Add to backdrop action.

  4. #4
    Clicker Fusion 2.5 Developer
    00J's Avatar
    Join Date
    Jun 2006
    Location
    Virginia, USA
    Posts
    1,510
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Create a random object from set

    Pick A Random Object In A Zone
    The Pick A Random Object In A Zone condition picks an object at random in a specific zone of the frame. It then performs all of the actions on that event line to the selected object.

    I thought this worked?

    here is some code I made.

    Code:
    Pick a Random object from zone (-56,92) to (-6,248)
     then I have 4 of the active object diamonds outside the play area filled in the center with yellow, green, blue, and magenta
    the code for them is 
    set x position to random (frame width)
    set y position to random (frame height)
     this positions them randomly in the frame. You can also add Run this event Once to allow only one of the objects to be placed randomly into the frame area.
    Here is the actual File.
    Pick Random Object File

  5. #5
    Clicker Fusion 2.5 Developer
    00J's Avatar
    Join Date
    Jun 2006
    Location
    Virginia, USA
    Posts
    1,510
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Create a random object from set

    I didn't realize how powerful and useful this would be until I started fiddling around with it.

    I actually concieved a small space game just from this issue.
    It does need to be expanded upon also. Creating Objects is probably the single most used option within MMF.

    So yeah I agree with everything said also.

    MMF is really pretty powerful now, and I think it's time this next year to have some really complex and useful additions to MMF come about.



Similar Threads

  1. Random object spawning random y set x
    By Armiferamortalis in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 23rd December 2013, 11:47 AM
  2. Random Chunk Generator using "Create New Objects"?
    By darkmanx_429 in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 7th August 2013, 12:42 PM
  3. Create random objects
    By Captain_Harris in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 7th August 2012, 06:28 PM
  4. "Create at a random position"
    By pikzilla in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 25th September 2009, 01:51 AM
  5. Noob on board... how to create random objects
    By rhodestown in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th December 2008, 09:53 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
  •