How do I spawn this correctly?

0 favourites
  • 4 posts
  • Ok so I believe I'm really close to figuring this out! Maybe haha but what I have set up and want to do is this. Let's say I have 6 objects on the screen and I click on each one. They all get added to the Array and have an variable associated to them from the family variable which is shown in the pick. Next I want it so each one is spawned on to the layout by index number/variable they got set to when put into the Array. Example if I clicked on object 3 which it's variable would be 3 and I click on like the button spawn or something I want that object to spawn onto the layout and if this can be done randomly that would be even better. Also I'm not sure if this can be done from families. Either way so help would be greatly appreciated, thanks everyone!

  • Not sure what you're trying to do and the explanation is a little messy. Can you explain what you are trying to do more clearly? The logic doesn't seem to do too much except add numbers 1-6 to an array in a random order based on clicked enemies. The spawning just creates a monster object.

  • Yeah I realized the explanation was off. I wanna click on Monsters, they get added to the Array then lastly I click on a different button and a random Monster gets spawned from that Array.

    The problem is I not sure if that's possible to do with an Array or if I need to take a different approach

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well the first question is, is the choice of monsters determined by them being clicked, is that the gameplay? If it's always the same set then you create an array without clicking on them. If the gameplay is to add them to the array and spawn what was added then fair enough, but I don't see how a number relates to a monster type? You should then create a monster and set the instance var to some random entry in the array I guess.

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