The Daily Click ::. Forums ::. Klik Coding Help ::. Multiple values for tiles using Array? (ie terrain type)
 

Post Reply  Post Oekaki 
 

Posted By Message

JetpackLover



Registered
  01/03/2007
Points
  212
26th November, 2012 at 26/11/2012 04:02:06 -

Hey there I'm making a level editor(rather I am editing one by neil butcher) Anyway what I want to know is how can I save a tile to Array to the X, Y index(something I already know) AND(what I don't know) save data for tile type, direction of tile, layer tile pastes to, tile terrain(for physics/sound effects etc.) for that same tile.

I know you can use the Z of the array but as far as I have figured out that would only give me 1 more value to add per tile right? (I honestly don't know)

It's boggling my mind! I just want this to be a thing

At XPos,Ypos write tile type, direction of tile, layer of tile and terrain of tile. and then be able to load that data. That would be rad.

I am humbly requesting help

Welp I'm gonna go cry now.





 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover


Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
26th November, 2012 at 26/11/2012 05:01:39 -

The Z depth can be as large as you want, meaning you have have multiple Z values stored in any X, Y coordinate.

Think of the array as a cube, on the face value of X, Y you can have a single value, but beneath (Or behind) that value, you can have (nearly) infinite Z values

 
Craps, I'm an old man!

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
26th November, 2012 at 26/11/2012 05:03:22 -

No, using the Z dimension gives you more than 1 extra value.

X = Horizontal position
Y = Vertical position
Z = Variable to store

eg.
Z:0 = Direction
Z:1 = Layer
Z:2 = Terrain

...so for example:
valueatxyz(5,6,0) = the direction of tile at position 5,6
valueatxyz(1,3,2) = the terrain of tile at position 1,3

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
26th November, 2012 at 26/11/2012 05:26:03 -

Between Sketchy and I, I hope we answered your question!

 
Craps, I'm an old man!

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
26th November, 2012 at 26/11/2012 13:09:16 -

Can't you have different values signify the tile at different orientations, and any special qualities? For example:

1 = road east-west
2 = road north-south
3 = road south to east (curve)
4 = road south to west (curve)
5 = road north to east (curve)
6 = road north to west (curve)
7 = road east-west with enemy 1
8 = road east-west with enemy 2

etc...

To be honest, I've not ever used arrays, but since you can have a multitude of numerical values, it makes sense (to me) that you could simply use an array value for pretty much any quality or condition you want.

 
n/a

JetpackLover



Registered
  01/03/2007
Points
  212
26th November, 2012 at 26/11/2012 18:50:51 -

I posted a thank you last night but as I did the site went down... I also wanted to thank you guys for being so prompt

Also I am glad that I am wrong about the Z value. I had a feeling I was. That is why I came here because I wanted to get the answer clarified.

Quick thought though. I'm using a 32x32 grid when I load for my level editor. And as far as I know I can't have values between the grid.((I'm sorry if this makes no sense I only started working with a level editor a few days ago(for the first time))

valueatxyz(32,32,0) = the direction of tile at position 32,32
valueatxyz(32,32,1) = the terrain of tile at position 32,32
valueatxyz(32,32,2) = the type of tile at position 32,32


(Would these be 3 values that you can hold on one tile? When you change the Z to 1 for example does that mean its completely on a new layer and that the X,Y is completely different from Z 0?)


Does this make sense? I get what arrays are they are basically the cubby holes that we would use in kindergarten to store our stuff. That would be a 2D array. Stacking cubby holes in front or behind would be 3D. I get that much.

I need multiple values per tile.

If I could get an example of how to use the z of an array to hold at the least 4 values per tile per position that would be excellent. Then I can just thoroughly look it over and figure out the rest on my own.

 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover


Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
26th November, 2012 at 26/11/2012 23:46:36 -

The bit in bold is correct. The rest doesn't make a lot of sense to me...

Here's a very simple example of storing two values at the same X,Y position: http://sdrv.ms/UXFsCp
It doesn't matter if you want to store 2 or 4 or 400 different values - you still do it in exactly the same way.

 
n/a

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
27th November, 2012 at 27/11/2012 03:08:39 -

**(Would these be 3 values that you can hold on one tile? When you change the Z to 1 for example does that mean its completely on a new layer and that the X,Y is completely different from Z 0?)**

I understand what your saying, You will have to move the Z axis when locating the tile location to 0 (im assuming you will have them on XY and Z=0. If you move the index to z=1 then you will have to move it back down to 0 if you want to access Z=0. So say you have all your tile locations in z=0. Picture Z=1 as a number floating above it, then Z=2 as floating above that, You just move the Z index depending on what information you want.

Does that make any sense? i hope it does.

 
n/a

JetpackLover



Registered
  01/03/2007
Points
  212
27th November, 2012 at 27/11/2012 04:45:30 -

Yep I totally get it now! Thanks everyone!

I can't tell you how much I appreciate how helpful TDC is to it's community. I just can't tell you...I can't express it

 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover


Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
27th November, 2012 at 27/11/2012 12:41:02 -

I love this site!!!

Good luck with your game.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click