How do I display 1 monster per box (using array)

  • Hello Everyone!

    I working on making a bestiary in my game. The idea is to push a button and a new layer becomes visible and gets populated with monsters you have obtained.

    On this new layer I have 5 boxes called beast box. each has a instance variable called box_id

    All my monsters have an instance variable called mob_id and are part of a family called mob_family. I also have an array for the monsters called array_monsters where I store the mob_id at position (0,1) for each monster. (3 monsters so far so 3 arrays are created)

    What I want to happen is check each monster box id and match it to the correct monsters array.at(0,1) and spawn the appropriate monster in the box. (Box ids start at 0,1,2,3,...) (Monster ids start at 0,1,2,3,...) as well So If box id = 0 & mob_id = 0 spawn a badguy in first square, etc.

    What happens now is I press 'B' My layer shows up, and the first 3 boxes get populated with random monsters from the family instead of my intended order of 0,1,2 (bad guy, slime, goblin)

  • I don't really understand what you're doing with the "array_monsters". Why are you making several instances of it when you probably should be using several X/Y of it.

    It feels like it would be far simpler if you posted your capx so we could investigate exactly how you did things so far.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could work it out with this tutorials

    https://www.scirra.com/tutorials/1090/using-arrays

  • I've included my capx. I was using instances of the array_monsters cause I have multiple stats for each monster and I don't know of any other way to store them in a single array for multiple monsters

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