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

Get help using Construct 2

Post » Thu Aug 28, 2014 1:25 pm

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)
You do not have the required permissions to view the files attached to this post.
Last edited by smoke84 on Thu Aug 28, 2014 3:21 pm, edited 1 time in total.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Thu Aug 28, 2014 1:44 pm

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487


Post » Thu Aug 28, 2014 3:23 pm

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
B
15
S
4
Posts: 31
Reputation: 1,267


Return to How do I....?

Who is online

Users browsing this forum: Centra and 2 guests