How do I populate this Array

0 favourites
  • 3 posts
From the Asset Store
Easy to use shop and inventroy populated by an array!
  • ok so I been messing around with Array's and I believe I got the process down on how to populate it but I just wanna double check and see if this is correct? Then after successful populate... how do I randomly spawn an object from this? From how it looks now... i'm thinking I might have done the populate process wrong because I don't see how to spawn an object from this. Thanks everyone for any help on this problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What do you mean by "spawn an object from this"? From what, from the array?

    Also, you are adding each value into the array twice - one at the start of the array and one at the end.

    Run your game in Debug Mode, select your array and you'll see.

  • What do you mean by "spawn an object from this"? From what, from the array?

    Also, you are adding each value into the array twice - one at the start of the array and one at the end.

    Run your game in Debug Mode, select your array and you'll see.

    yes you are correct! I checked and it did get added twice. For the next part... I have for example an animation with 20 frames and each of those frames are on my layout 1-20 what I want to do is when I for example double click on frame 2... that frame 2 image gets added to the Array, I double click on frame 5 and the frame 5 image gets added to the array and so on till I have added 10 of the 20 frames to the Array. Then I wanna be able to randomly create those 10 added frames onto the layout.

    I didn't know if it would be better to do this way with image frames or just use 20 actual objects and not an animation. I'm sure if I do the animation way I will need a variable to reference each animation frame. I hope this makes sense so in short... I want to add whatever objects/animation frames I double click on, to the Array and then and then for example I click drop... those objects/animation frames are created randomly one by one on the layout till all 10 are gone from the Array.

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