Archived

This topic is now archived and is closed to further replies.

caffeineaddict

Help with arrays.

Recommended Posts

Hi, say for example you have a cube and you divide each cube into different sections, or into smaller cubes. Each small cube can start off the same color, is it possible to figure out which array element the block is, for example... say i have something like this int front[4][1]= {{RED},{RED},{RED},{RED}}; that just says the front of the cube has for smaller squares in it. And each starts off red, how can i find out which element is which when it is displayed on the screen, I want to do some translations with it using opengl, the translations aren''t a problem, I just need to figure out which one to translate, if this isn''t stated clear enough i will try and make it more clear if someone asks. Thanks in advance.

Share this post


Link to post
Share on other sites
OK, i''m not talking about mouse clicks or anything, i just want to find the location in the array that each piece is, like i want to know which block is the upper left hand cube in the array. If it''s [2][1] or whatever, i just want to know how i can figure this out.

Share this post


Link to post
Share on other sites
Your array looks more like a line than a cube, since it''s [4][1].
I''d imagine that the lower elements are, the farther to the upper left. Does that sound sound right?

-Forcas


"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."



Share this post


Link to post
Share on other sites