Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For loop help
darksky Offline
Member

Posts: 52
Threads: 8
Joined: Nov 2012
Reputation: 2
#3
RE: For loop help

for (variable; condition ; to do after each repetition){
do something;
}

as long as the condition is true, "do something" will be called again and again. after each call " to do after each repetition" is called. i++; is a short term for i = i + 1;

"PathNodeArea_"+i just inserts i at the end of the string. e.g. if i=2
then "PathNodeArea_"+i would resolve to "PathNodeArea_2"

if you want i to start with 16, just set i=16 ( for (int i = 16;...;..) )

maybe it helps if you take a look to the equivalent while-loop

int i = 1;
while (i<6){
   AddEnemyPatrolNode("grunt_1", "PathNodeArea_"+i, 0, "");
   i++;
}

is equivalent to

for(int i= 1; i <6; i++)
{
    AddEnemyPatrolNode("grunt_1", "PathNodeArea_"+i, 0, "");
}
(This post was last modified: 02-17-2013, 11:23 PM by darksky.)
02-17-2013, 11:23 PM
Find


Messages In This Thread
For loop help - by tonitoni1998 - 02-17-2013, 11:07 PM
RE: For loop help - by NaxEla - 02-17-2013, 11:19 PM
RE: For loop help - by darksky - 02-17-2013, 11:23 PM
RE: For loop help - by tonitoni1998 - 02-17-2013, 11:25 PM
RE: For loop help - by TheGreatCthulhu - 02-17-2013, 11:51 PM
RE: For loop help - by tonitoni1998 - 02-18-2013, 01:45 AM



Users browsing this thread: 1 Guest(s)