Dictionary or Array for Enemy cataloging

Get help using Construct 2

Post » Sun Jul 20, 2014 10:27 pm

I want to store an Enemy type and Enemy weight (as in how powerful this enemy is) and have a spawn system that makes sure the total enemy "Weight" of all enemies isnt' greater than what is currently allowed, and will only spawn enemies that fit within the current weight liit. So something like this:

Enemy 1 weight = 1
Enemy 2 weight = 3
MaxWeightAllowed = 10
TotalCurrentWeight = 9

(Global Variable) next enemy = choose enemy where Enemy.Weight <= (MaxWeightAllowed - TotalCurrentWeight). 10 Max weight - 9 current weight comes out to 1, so i would want to go to any enemies that have a weight of 1, and randomly choose from within that family.

Would this best be done with an array, or dictionary? Thanks!
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Mon Jul 21, 2014 12:04 am

Image
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 51
Reputation: 502

Post » Mon Jul 21, 2014 3:00 am

Cool thanks so much!
B
35
S
5
Posts: 411
Reputation: 3,406


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests