0 Favourites

creating an instance of a random object

  • Hi guys,

    I have 6 different sprites set up in my layout and I'm trying create an instance from one of those (randomly selected) at a fixed timing rate. I have combined all of them in a family, but I only have the option to spawn the whole family-object.

    Since I only need one instance on screen at a time, I also have set up "Destroy" right before the "Create"-Action,

    While this seems to work ok, I'm not sure if this is the right way to do this... does anybody have another suggestion how to go about this?

    Any help appreciated, thanks!

  • I might be miss understanding the question you are asking, but the below tutorial helped me with random generating power ups. I hope this helps :)

    Tutorial

  • Hi guys,

    I have 6 different sprites set up in my layout and I'm trying create an instance from one of those (randomly selected) at a fixed timing rate. I have combined all of them in a family, but I only have the option to spawn the whole family-object.

    Since I only need one instance on screen at a time, I also have set up "Destroy" right before the "Create"-Action,

    While this seems to work ok, I'm not sure if this is the right way to do this... does anybody have another suggestion how to go about this?

    Any help appreciated, thanks!

    Doing a 'Create Family' event will create random member of that family.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Doing a 'Create Family' event will create random member of that family.

    Alright, wasn't sure if this would create instances of all objects in that family on top of each other. Couldn't really tell, because all my sprites have the same shape and size (just differing in color). But if it's only one random object, that's exactly what I wanted. Thanks! :)

    BurningWood:

    Thanks for the link! Right now I was just looking for a way to spawn a random object, not to set a random position... But this tut also might come in handy for me soon. :)

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