Creating random objects from a set ?

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I want to create random objects in an infinite runner platformer. The objects are tiled backgrounds and I need to create 1 out of them randomly each time.

    Here's How I am doing it for 1 Object currently :

    <img src="https://dl.dropboxusercontent.com/u/16564767/Screenshot%202014-02-01%2022.05.35.png" border="0" />

    I tried using Object families, but couldn't get it to work. I created a family "Blocks" and put all my tiled Bg Objects that I wanted to choose randomly from,in it. Then I replaced the "Block" object with "Blocks" family object (in the pic that I showed above). But, that doesn't create any object at all, on the screen. As far as I read somewhere, It should randomly choose and create one object from the family.

    I've tried giving the same behaviors to the family as those of its objects (bullet, solid)

    Is there any other way to get it to work ? Am I missing something ?

  • I might have this totally wrong - in which case I apologise.

    Judging by the lack of a medal in your avatar I think you must be using the free version ? I don't think that families work in the free version.

  • I'm creating it for a friend of mine who has the paid version.

  • I've created an event like this:

    every 2 seconds:

    destroy blocks (family)

    system create blocks (family) on layer ...

    And it worked without problem. So maybe you missed to exchange one vital block expression with, at least would be my best guess now.

    I might have this totally wrong - in which case I apologise.

    Judging by the lack of a medal in your avatar I think you must be using the free version ? I don't think that families work in the free version.

    Steam users for example don't get the badge, so you can't really be sure if the persons own the personal version either way.

  • Steam users for example don't get the badge, so you can't really be sure if the persons own the personal version either way.

    Thank you - I didn't know that.

    Perhaps it would be a good idea to give Steam purchasers a medal to save this potentially embarrassing situation?

  • I've created an event like this:

    every 2 seconds:

    destroy blocks (family)

    system create blocks (family) on layer ...

    And it worked without problem. So maybe you missed to exchange one vital block expression with, at least would be my best guess now.

    I couldn't get how would that work ?

    You meant like this ? :

    <img src="https://dl.dropboxusercontent.com/u/16564767/Screenshot%202014-02-02%2019.17.42.png" border="0" />

    It's not working..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Why don't you use array and/or dictionnaries. And define for each key (s) the behaviours.

  • Why don't you use array and/or dictionnaries. And define for each key (s) the behaviours.

    Can you shed some light on how could I achieve the object randomness through arrays/dictionaries ? An example or something..

    I tried doing a new way out:

    <img src="https://dl.dropboxusercontent.com/u/16564767/Screenshot%202014-02-02%2022.46.12.png" border="0" />

    But it failed too. The block2 gets created in air..

  • Here's a sample project where I tried to use the family concept but wasn't able to achieve it:

    dl.dropboxusercontent.com/u/16564767/runner.capx

    Any help would be appreciated..

  • Is there no way out ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)