How do I put an object type in an array?

Get help using Construct 2

Post » Sun May 01, 2016 11:57 am

I tried typing down the name of the object, but it says that I need a dot or smth.. I want all objects of that type to be in the array.. How?
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Sun May 01, 2016 1:27 pm

Array only takes in number and text, not the object type. Because of this, you may wish to use either number or text to refer to an object you want.

But may I ask, what are you trying to accomplish? Why do you want to store object type in an array?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Mon May 02, 2016 2:26 pm

I'm trying to make an object upgrade to more levels using only 1 button every time, so when that button is clicked, I just upgrade it to the object with an index +1 of the previous one, instead of checking which object needs to be upgraded..
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Mon May 02, 2016 3:46 pm

Upgrade the object using object type in array? So are you gonna destroy the original object and create the upgraded version in the original's place? Something like this?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Mon May 02, 2016 6:57 pm

Yes, that's the plan :3
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Tue May 03, 2016 5:17 am

C2 can't create instances from text string but you can do so with Nickname plugin: plugin-nickname-behavior-nickname_t74522 and store the name of your objects in text in the array. Then, refer to these text and create objects with respect to your plan.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 27 guests