Create a line of monsters

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi all,

    I am trying to create a tower defense type game but I am having problems making a list of enemies appear, I'll try to explain...

    What I want is there to be a line of, lets say: enemy1, enemy2, enemy1, enemy3. with a 2 second gap between them and I would like to create them from a sprite "Start".

    I am able to do this with all the same enemies but I can't seem to work out how to get it to work for different ones??

  • Use a one-dimensional array containing a number or string for every enemy type.

    If you don't understand arrays, it won't make much sense, but if you do, you will see what I mean.

  • I did try that but I couldn't seem to work out how to run through the list to create a different creature each time with a gap of 2sec.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use a single object with multiple instances.

    You just define the differences between the enemies using instance variables, and animations.

  • I'd do something like this.

    Make an array, each entry corresponding to a monster type.

    Then try something like:

    global variable monsterIndex = 0

    every 2 seconds:

    if array.at(monsterIndex) = "zombie"

    --> create zombie

    if array.at(monsterIndex) = "ghost"

    --> create ghost

    if array.at(monsterIndex) = "squid"

    --> create squid

    (etc, for all the monsters)

    Add 1 to monsterIndex

    Do you see what I'm getting at?

  • Excellent, I hadn't thought about using the variable as the array ref.

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