Jump to content
  • Advertisement


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


a 2d array question

This topic is 5753 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!