The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with Array
 

Post Reply  Post Oekaki 
 

Posted By Message

z3lda



Registered
  07/06/2003
Points
  16
4th March, 2004 at 01:59:00 -

Ok, I'm making a level editor using arrays and easy grid textension. Basically each xy of the array is a tile in my map of 30x20 = 600 possible tiles in the level. The value stored in the array determines what tile I draw.

I can store and save the array fine.

What I'm having problem is parsing through the data to draw the correct tile. I'm using fast loops to parse through the array to draw the map.

Just for testing I only parse through the first row. Y=0, X=0-29, here is the following code.

Start of frame - Start loop "Fill" DimX("my array") times
On Loop "Fill"

1. I set a pointer(graphic arrow) to the current location of x,y
2. Set X dimension Index to LoopIndex( "Fill" ) + 1
3. Create my tile relative 0,0 to the pointer

I need to set it up so it will only draw the tile when the X,Y value of the arrow = 1(a specific type of tile)

I tried adding the following condition below "On Loop 'Fill'"
ValueatXY("my array",index x("my array"),index y ("my array")) = 1

and the result of this is that nothing is drawn.

I dunno if what I typed above makes any sense? heh.

John



Image Edited by the Author.

 
n/a

Mr Icekirby



Registered
  18/12/2003
Points
  846
4th March, 2004 at 17:06:11 -

i can't really say that that makes sense... can you email me the file?
SupreemGoob@hotmail.com

 
Mr Icekirby says so!
OBEY ME!

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
4th March, 2004 at 18:17:04 -

i don't see the relevance of the pointer object there, but anyhoo

what i do is basically:

+ On loop
- Set x dimension index to (Loopstep)
- Set Alterable Value A of object to "current value(array)"

+ On loop
+ If Alterable Value A = 1
- Create object
- set postition to "current value(array) * 6"

if you want to look at it in more depth dc mail me and i'll send you the source file.

Image Edited by the Author.

 
www.thenatflap.co.uk

cake



Registered
  13/12/2002
Points
  1173
4th March, 2004 at 23:03:38 -

You can have a look at my article if you wish. It really is a LOT easier and more reliable to use active picture object

Article: http://create-gamescom.winstemp.com/article.asp?id=1262

 
n/a

z3lda



Registered
  07/06/2003
Points
  16
4th March, 2004 at 23:27:16 -

Pete Nattress,

Thanks for the clicking. It worked. I think before I set the

+ If alterable value a= 1 in the top "On loop" and it messed it up.

thanks to everyone.

John

 
n/a
   

Post Reply



 



Advertisement

Worth A Click