Hey guys so I've been working on a map editor, its been going really well.
I'm using good ol multi-d arrays.
I wont bore you with all my scripts as I'm having trouble with just one issue.
I'm trying to get a feature going where on start you click new map and give it the bitmapdata and tile size and so on.
ActionScript Code: ///New map hand coded var canvasPlan:Array = [[100,100,100,100,100], [100,100,100,100,100], [100,100,100,100,100], [100,100,100,100,100], [100,100,100,100,100]]; trace(canvasPlan); //New map generated var finalPlan:Array = new Array(); var plan2:Array = new Array(); //Create rows for (var w:int=0; w<cWidth; w++) { plan2.push(deFrame); } //Push into cols for (var h:int=0; h<cHeight; h++) { var insertPlan = plan2; finalPlan.push(insertPlan); } ///Final array canvasPlan = finalPlan; trace(canvasPlan);
deframe=100, cwidth/height=4
They both seem to create the same array, then I create a new drawGrid object the does what it sounds like.
And this works, they both are drawn the same grid.
Later on down the line I have a pencil tool, select tile from palette then the array is changed via plan[var][var] and the bmp is updated to reflect that.
This works for the first hand coded array plan, but for the second generated one it will replace the entire column with the desired tile.
I've been trying really hard to figure this out, but I Just can't. So does anyone have an idea as to why it could be doing this, or a better method to write my array generation function.
=)
Tile Based map editor
Tuesday, May 22, 2012
[Action Script] Tile Based map editor May,2012
Posted by Bimo Hery Prabowo at 11:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment