The Daily Click ::. Forums ::. Klik Coding Help ::. More Array Issues!
 

Post Reply  Post Oekaki 
 

Posted By Message

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
3rd November, 2008 at 08:37:42 -

Ok so I've got a dynamic array that looks like this:

N,N,N,N,N,2,3,2,3,2
N,N,N,N,N,2,2,2,4,2
2,3,2,N,N,2,2,2,2,2
2,2,2,N,N,2,4,2,2,2
2,4,2,N,8,2,2,2,2,2
2,2,2,N,N,2,2,2,2,2
2,4,2,N,N,2,2,2,4,2
2,2,2,5,N,2,2,2,2,2
4,2,2,N,N,2,4,2,2,2
2,2,2,N,N,2,2,2,2,2
10,10,"","","","","","","",""


The numbers are the different tile values, N means a blank tile and the last two numbers are just the array's dimensions (10 x 10)

Now I want to load an array into the game, but the new array can have different dimensions like 13 x 14 or whatever.

I tried loading the new array to the Dynamic Array object but instead of replacing the array it already had, it added the new array onto it like this:

N,N,N,N,N,2,3,2,3,2
N,N,N,N,N,2,2,2,4,2
2,3,2,N,N,2,2,2,2,2
2,2,2,N,N,2,4,2,2,2
2,4,2,N,8,2,2,2,2,2
2,2,2,N,N,2,2,2,2,2
2,4,2,N,N,2,2,2,4,2
2,2,2,5,N,2,2,2,2,2
4,2,2,N,N,2,4,2,2,2
2,2,2,N,N,2,2,2,2,2
10,10,"","","","","","","",""
N,N,N,N,N,N,N,N,N,N,N,N,N
N,N,N,8,6,6,7,5,N,N,N,N,N
N,N,N,N,N,N,N,N,N,N,N,N,N
2,2,3,2,2,N,N,N,N,N,2,3,2
2,2,2,2,2,N,N,N,N,N,2,2,2
4,2,2,4,2,N,N,N,N,N,2,4,2
2,2,2,2,2,7,7,7,5,N,2,2,2
2,2,4,2,2,N,N,N,N,N,2,2,2
2,4,2,2,2,N,N,N,N,N,2,2,4
2,2,2,2,2,9,9,9,9,9,4,2,2
2,2,2,4,2,N,N,N,N,N,2,2,2
2,2,2,2,2,N,N,N,N,N,N,N,2
2,4,2,2,2,N,N,N,N,N,N,N,2
2,2,2,2,2,N,N,N,N,N,N,N,2
13,14,"","","","","","","","","","",""

I need a way to load the new array and replace the old one with it in the Dynamic Array object, rather than just adding it on the end.

Help would be much appreciated!

 
n/a ...

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
3rd November, 2008 at 09:13:25 -

can you duplicate the problem in an example? i could figure it out better that way, if someone doesnt give up the answer first.

 
n/a

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
3rd November, 2008 at 09:37:06 -

Ummm, I might just try and explain it better: I need a way to "Load and replace" instead of just "Load"

Ehh that's still a bit confusing.. I'll try and explain with fruit... Ok I have a fruit and its value is tasty apple... Now I want to turn this tasty apple into a yucky rotten banana. I have a yucky rotten banana in my food documents BUT when I "load" it to the fruit, the fruit's value is now: tasty apple yucky rotten banana.

I want it to just be yucky rotten banana, ie: I want to get rid of the tasty apple value altogether and put yucky rotten banana in it's place... hence "I need a way to "Load and replace" instead of just "Load""


If that's easier to think about, just replace 'Fruit' with "dynamic array" and the different fruit values are just different array grids.

Man, everything is easier with fruit.

Image Edited by the Author.

 
n/a ...

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
3rd November, 2008 at 10:41:17 -

Oh lol I've just amazed myself again. In my level editor, the frame size is relevant to the array dimensions, so you might start making a map with 56 x 74 grid squares. Now you want to load a level but it is 103 x 12. I've made it so not only does the dynamic array object load the new level and replace the old one with it, it now resizes the frame to the correct dimensions and sets all the global values correctly,

The level editor and grid are actually two different applications and I'm using the Sub-Application object to display the "drawing area" (grid) in the main application that has all the drawing tools in it. So the global values get a bit confusing sometimes lol.

I keep getting real stuck and posting help topics, then about an hour later I go back to it and try again and it works.

Image Edited by the Author.

 
n/a ...
   

Post Reply



 



Advertisement

Worth A Click