How do I use an Array as a spawning system?

Not favoritedFavorited Favorited 0 favourites
  • 14 posts
From the Asset Store
Memory Matching gaming template - using language symbols and writing systems.
  • Im trying to create a spawning system for a Tower Defence game. I was looking at the following tutorial: youtu.be/wB8mIAHf4E0. At 2:45 they use the Event sheet to look at the array to see the amount of that enemy type to spawn.

    This does not seem to work for my game. The Event sheet does not seem to have any reference to the array.

    I have also tried looking at the following documentation, but found that this does not work either:

    construct.net/en/make-games/manuals/construct-3/plugin-reference/json

    Am I missing something, like a setting? If anyone has a better way of doing this, that would be super helpful.

  • You mean you can't add an Array or JSON object to your project?

    Check "Use simplified interface" in program settings and make sure it's disabled.

  • I can add. When it comes to using the Event sheet, it doesn't seem to know the array exists. I have looked at the documentation and have the JSON and AJAX but still cant make it work.

  • I used the Debugger, and I can see that information has been loaded into the array.

    I set a text box as one of the cells in the Array to see if I could get the value to show. It came back with the value 0, it shouldn't be that. Am I using the wrong expression here?

  • When it comes to using the Event sheet, it doesn't seem to know the array exists.

    What do you mean by that? You wrote yourself that you are using the array object in an expression.

    Can you show a screenshot of the entire event sheet - where you populate and access the array? Maybe you are trying to read from the array before the data is loaded?

  • Hello. I'm sorry for getting into your question a bit.

    I noticed in this guy's video that he has some kind of plugin for Construct3. Does anyone know what he does?

    My search on the photo didn't give me anything.

  • Here is how im populating the array.

  • I set a text box as one of the cells in the Array to see if I could get the value to show. It came back with the value 0, it shouldn't be that.

    Can you show this code too? The entire event, or even the entire event sheet.

  • Like this?:

  • Hello. I'm sorry for getting into your question a bit.

    I noticed in this guy's video that he has some kind of plugin for Construct3. Does anyone know what he does?

    My search on the photo didn't give me anything.

    The image you posted is Grammarly. It's used for spelling and grammar correction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have now managed to get it to work. Turns out I needed to add a wait command in the following code:

    Now I just need to figure out how to make them spawn one at a time. I have a for loop at the moment, which is spawning them all on top of one another. I also need to get the next wave to spawn, should just need to make a function for this one though.

  • The image you posted is Grammarly. It's used for spelling and grammar correction.

    Thank you very much, I didn't use it, so I didn't recognize it. In general, I think it's better not to use add-ons in the browser where we use Construct3.

    Now to your question, the action that I marked orange will be executed faster than the data will be loaded into the array.

    I would recommend moving this action to a group and disabling it when the layout starts and enabling it when the layout is complete. I marked it on the screenshoot.

  • Turns out I needed to add a wait command in the following code:

    Why do you set AllEnemiesDefeated to true immediately at the start of layout?

    Deactivating/activating the groups as Igor has suggested is a better solution than adding a wait.

    Another good option is to load the array in advance in a separate layout (say, in the splash screen or loader).

  • Thanks for all of the help.

    I can't remove the addon as it is forced on at work.

    Im not sure why I was setting the bool at the start of the layout. I have removed this and changed the initial value.

    I have now changed to deactivating the group at the start, which works much better and means I don't need to add waits into my code.

    Thanks again :)

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