Archived

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

werdy666

a 2d array question

Recommended Posts

lets say i have an arry like such.... array1[28][25] the array is already filled with the values it needs. Now what i want to do is expand the array 10 times. So we make a new array such as..... array2[280][250] now what i want to do is to copy the contents of the array1 into the array2, filling it completely. So i want it to be if array1[0][0] = 1 then i want array2[0][0] to [9][0] = 1 also. How the hell do i do this in a loop of some kind?? lol i have no idea! maybe 1am isn''t the best time to think of stuff like this! Any help would be greatly appreciated! This is in relation to a collision detection problem i am having in an opengl tiling program. which is right here http://www.gamedev.net/community/forums/topic.asp?topic_id=120452 Please note: i don''t think this is a crosspost, cause this problem is not entirely related to my original problem. But it might help explain what i am trying to do. Werdy666 My Homepage : http://werdy666.20megsfree.com/

Share this post


Link to post
Share on other sites
I assume this is what you want:

  
for (int e=0; e<280; ++e)
for (int i=0; i<250; ++i)
array2[e][i] = array1[e / 10][i / 10];

Abstract to whatever degree you see fit

Share this post


Link to post
Share on other sites