How do I loop through sprites and test instance variable

Get help using Construct 2

Post » Mon Apr 25, 2016 11:04 am

I have several enemy sprites that I am trying to loop through using a for each loop and then have that sprite perform an action based upon the value of an instance variable. However, it's not even entering the loop. Any suggestions on how to do this? Thanks.
B
16
S
7
Posts: 46
Reputation: 1,344

Post » Mon Apr 25, 2016 2:58 pm

It's not even entering the loop?

Have you include the right event sheet into the layout you are testing on and are you referring to the right enemy sprites?
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 » Tue Apr 26, 2016 12:54 am

Ok, it is entering the loop, not sure what I did to make it fail in the first place. However, I need to compare two conditions inside the foreach loop, but Construct 2 won't let me use an else statement for some reason. I've attached .capx. Thanks.

Image

https://www.dropbox.com/s/0e14dnd4wgb0efn/Uru.capx?dl=0
B
16
S
7
Posts: 46
Reputation: 1,344

Post » Tue Apr 26, 2016 3:23 am

Your syntax is wrong is all. Else is used like this:

Image
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 204
Reputation: 3,466

Post » Mon May 23, 2016 4:57 pm

Got it thanks!
B
16
S
7
Posts: 46
Reputation: 1,344


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 56 guests