Array problem (RTS mechanic)

Get help using Construct 2

Post » Sat Aug 03, 2013 12:24 am

I'm trying to make an object "store" other objects, for which I'm using an array.

So far it works, objects come in and out. But I have a couple problems with it =/

    1st, I wanna store a 2nd value with each object (in this case HP) and i don't know how to set or call for the Y of the X the stored objects are using. Maybe i'm doing it all wrong.
The way I made it, is that each objects uses the "push front" action. maybe I need to check for unused spots or something D:

    And 2nd; for some reason that's making me wanna kill myself; when the 4 stored objects are the same type, it just doesn't work =(

My CAPXSargas2013-08-03 03:26:42
B
43
S
12
G
6
Posts: 446
Reputation: 6,797

Post » Sat Aug 03, 2013 3:27 am

arrays are hard -_-

still can't solve this
B
43
S
12
G
6
Posts: 446
Reputation: 6,797

Post » Sat Aug 03, 2013 5:13 am

trying to use the push/pull method on a multi-dimensioned array will not work unless each dimension is unrelated to the others.

Also, why it does not work with 4 objects...you destroyed each object as it collided with black, and after 4 were destroyed, there were no more instances available to create from. To fix, I added 1 Red and 1 Blue outside the viewport.

Here is your better way:




https://www.dropbox.com/s/go1hklpb4hi8u2y/array%20container%20ver2.capx
B
5
Posts: 26
Reputation: 277

Post » Sat Aug 03, 2013 9:04 am

Yey, thanks Kosiam!

Your way of doing it is pretty much what I imagined it should look like :D
It was really clever to use the variable for locating the X's.
With that I was able to set and use a Y value as well ^^

About the problem when all 4 are the same... I've done a ton of capx where even when there is no instance left; I can Create a new one. Heck, my main project does this without any trouble -_-
There must be something else causing this problem. (Although having +1 around does solve it D: i'm confused xD)
B
43
S
12
G
6
Posts: 446
Reputation: 6,797


Return to How do I....?

Who is online

Users browsing this forum: giorgio1982, Xh3maa and 2 guests