Guest Croccy22 Posted March 29, 2003 Report Posted March 29, 2003 This has got to be easy but yet again my brain has turned into mush. At the moment I am decalring an array at the beggining of my code like this: int LevelData[64] ={1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,}; the problem is later on the game this gets modified. What I need though is when a new game is started, LevelData[] must be refilled with the original data. How can I do this. I have tried doing like LevelData[64] = {1,2,3,4,} etc but it doesn't work. Does anybody know what I mean?? I know I can fill it number by number but I don't want to do that. Help???? Matt
Guest Arisme Posted March 29, 2003 Report Posted March 29, 2003 Why are you not using 2 copies of the array ? The original and the working copy, in which you copy the original when you need to ...
Guest Croccy22 Posted March 29, 2003 Report Posted March 29, 2003 how can i copy one array to another? original[] = working[] ???
Guest v1nn1e Posted March 29, 2003 Report Posted March 29, 2003 original[] = working[] ??? This will jus copy the pointer to the memory location of the data. It won't actually make a duplicate of the array. changing original[1] would be the same as changing working[1] because they point to the same thing. You have to copy each element using a loop to a new array. This is how it is done in JAVA
Guest Croccy22 Posted March 29, 2003 Report Posted March 29, 2003 Yeah thanx just figured it out. I have been programming far too long today. Oh well nearly finished public Beta! And yes I know there is still stuff to do (as you will find out). But tough! :lol: Just really wanna see if anybody actuallt plays the game before wasting my life coding it! Matt
Guest Vector Posted March 30, 2003 Report Posted March 30, 2003 Man, i wish i knew about all this developing stuff :cry:
Guest yatpeak Posted March 30, 2003 Report Posted March 30, 2003 Yeh, I intend to learn C++, but first I've got to find a decent tutorial. :lol: Wyatt
Guest Emad Posted March 30, 2003 Report Posted March 30, 2003 Try here: http://www.cprogramming.com/ I learnt C++ by starting from C, then just playing about. Learnt C using The C Porgramming Language by Kernighan and Ritchie - teeny book, but packed..
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now