I have an array and Im creating a object (sprite) for each element of that array its fine but now I need to swap between to x values in other words I need to create that object in column 90 and the next at column 180 and the next at column 90 etc... How to do this easly with only one loop ?
Example:
the_x = 90
for each element in the array
{
create(the_x, 100)
if (the_x == 90) the_x = 180 else the_x = 90
}
or something like this
obs: I cant put this information on the array itself because Im using it to store de Text property....
Thanks in advance!
Develop games in your browser. Powerful, performant & highly capable.
Wow, not really sure what you mean. I can get that English is probably not your first language, but using some punctuation and more detailed explanations... might help others to understand what you want.
I'm also not sure what you mean by "each element of the array" unless you mean for each object (in the array), or maybe each column?
Best of luck.
~Sol
Yes my friend, Im from Brasil. But forget the text and se at pseudo code, I replicate this algoritm in C2....
create_a_instance(objany, the_x, 100)
Thanks
+ for "Y" from 0 to 9 ++ for "X" from 0 to 1
create object at 90+loopindex("X")*90, loopindex("Y")*100
This will create 20 objects in two columns.
> + for "Y" from 0 to 9 ++ for "X" from 0 to 1 > create object at 90+loopindex("X")*90, loopindex("Y")*100 This will create 20 objects in two columns.
> + for "Y" from 0 to 9 ++ for "X" from 0 to 1 > create object at 90+loopindex("X")*90, loopindex("Y")*100
Hummm almost there but not yet... Se the picture below:
<img src="http://dl.dropbox.com/u/16702799/temp/Capture.PNG" border="0" />
">
I need each the 40 to change to 180 on each iteraction of the loop.
1-40
2-180
3-40
4-180
But I needt to use this for..each loop above because the size of the array will be variable so I cant use your solution....
Help pls!
Create a local variable before your for loop and check it.
example
Or use a conditional expression like: "loopindex%2=0 ? 40 : 180"
Example
Thanks a lot dudes its worked both!
I did not know of the existence of "conditional?" It's in the help of expressions?
Another thing, also did not know how to create a local variable in a group. Now that I found that just create a global variable and drag it to the group, logically it becomes "local" heheeh.