|
Registered Member
Join Date: Mar 2009
Posts: 42
|
Quote:
Originally Posted by rhfb
Well if you can get the value of each brick (using similar code to your x and y values (i%8, i/8)) You could use a switch statement to create the correct imaged brick. I don't know how exactly the code would look since I haven't used switch statements in Obj-C yet. So basically you need to do two things.
a) get the correct value for that brick (some people would use two for loops to do the same thing you are doing with just one)
b) use that value to assign the image to the view.
|
Yeah, see that's kind of the idea I was thinking of. But I'm not sure how to create such an array that looks like the following and loop through it as well:
brickArray *brickLevel1 = {
{0,0,0,0,0,0,0,0},
{1,1,0,0,0,0,1,1},
{1,0,1,0,0,1,0,1},
{1,0,2,0,0,2,0,1},
{1,0,2,0,0,2,0,1},
{1,0,1,0,0,1,0,1},
{1,1,0,0,0,0,1,1},
{1,1,3,1,1,3,1,1}
};
I'm sure I could figure out the switch statement logic to replace the 1 with blue.png and the 2 with yellow.png, etc.
I'm just not 100% on the way to create that array and loop through it properly? Any ideas?
Last edited by fulvio; 03-17-2009 at 10:29 PM.
|