![]() |
Dumb array question
I'm trying to script a system to create, display, and destroy "message box" type widows on the screen. The only thing is, I need to address each box as an individual object containing an x,y position. Now, how do I do this without using a multi-dimensional array?
|
You could sort of recreate a multi-dimensional array in one array, you just need to make the array twice as big as usual, and use some extra calculation while accesing it to seperate the x and y values.
a+b*c is the key. |
what i do when i use 1 array for things like x & y you can ether put them side by side or at equal lenghts apart.... {x, y, x, y } {x, x, y, y,}
with the first one to acess the x & y its index = x & index +1=y the second is index=x index+(lenght of first part of array)=y |
I just do what Graal does offline in the tile selection window thing. Take this matrix, for example...
NPC Code: Those can be all the indexes, and you can treat them exactly like x,y coordinates. Just do row * 5 + column to get a specific index (start counting at 0). |
NPC Code: This is basically how I do it. I been using arrays for a long time. This works. |
| All times are GMT +2. The time now is 12:00 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.