How do I use a for loop

Just started using Construct 2? Post your questions here

Post » Sat May 02, 2015 7:08 pm

Where can I find nice examples of for loops? :)
Thanks.
One of my recent games: Plants
B
33
S
7
G
9
Posts: 747
Reputation: 6,842

Post » Sat May 02, 2015 8:26 pm

variable = "apple;orange;banana;strawberry"

on start of layout
for 1 to tokencount(variable, ";"):
set text's text to text.text & newline & tokenat(variable, loopindex-1, ";")
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Thu May 07, 2015 10:44 am

To create an array of grid:
download/file.php?id=6822

or counting numbers:
viewtopic.php?f=178&t=122281&p=871630#p871630
ImageImage
B
136
S
56
G
24
Posts: 812
Reputation: 24,617


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests