what is for(5 (i)=>{..........}
4 posts • Page 1 of 1
what is for(5 (i)=>{..........}
hi i saw ones in a topic:
oncollide:= (e)=>{ for(5 (i)=>{scene.addcircle({pos:=e.pos;heterocollide:=true})}}
what does that mean (''for(5 (i)=>{......}
does it mean that it spawns 5 balls per time collide?
oncollide:= (e)=>{ for(5 (i)=>{scene.addcircle({pos:=e.pos;heterocollide:=true})}}
what does that mean (''for(5 (i)=>{......}
does it mean that it spawns 5 balls per time collide?
- jessebax129
- Posts: 34
- Joined: Tue Jan 05, 2010 6:32 pm
Re: what is for(5 (i)=>{..........}
Exactly! It repeats the script five times if used right. You can try it and see for yourself. 
-

Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: what is for(5 (i)=>{..........}
Rideg wrote:Exactly! It repeats the script five times if used right. You can try it and see for yourself.
wow okay but how does the script look like? it doesn't work with (e)=>{ for(5 (i)=>{scene.addcircle({....})}
- jessebax129
- Posts: 34
- Joined: Tue Jan 05, 2010 6:32 pm
Re: what is for(5 (i)=>{..........}
jessebax129 wrote:Rideg wrote:Exactly! It repeats the script five times if used right. You can try it and see for yourself.
wow okay but how does the script look like? it doesn't work with (e)=>{ for(5 (i)=>{scene.addcircle({....})}
You wrote wrong. (e)=>{for(5, (i)=>{scene.addCircle({radius := 0.5; color := [0.0, 0.0, 0.0, 1.0]; pos := e.pos; })})}
You forgot the comma (,) between (5 and (i)=>{}.
You wrote for(5 (i)=>{}
This works(5, (i)=>{}
-

Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest




