This can be done with cloning...
The method should be :
-> Create the map
-> Save each tiles infos (x,y,animation) into arrays
FIrst, make the array variables.
TileX, TileY, TileAnimpos
The size should be the total size of the map size. If your map size 20x20, then the array size should be 400.
TileX[400], TileY[400], TileAnimpos[400]
When in Creating Map Mode :
-) Map=>Create Actor=>ScriptEditor :
- Code: Select all
TileX[cloneindex]=x;
TileY[cloneindex]=y;
TileAnimpos[cloneindex]=animpos;
//cloneindex would point the current actor clone index
//you can view that index number by the Actor's name on Actor Control Panel
//Actor.0 Actor.1 Actor.2 etc
Your tile's clone number must be under 400. Or else your array would be out of bounds.
To save Map infos :
-) Simply :
- Code: Select all
saveVars("data.dat","variablegroup");
//I don't need explain this
To generate maps next time you load the game :
-) Make a function to do this :
- Code: Select all
void LoadMap()
{
int i;
loadVars("data.dat","variablegroup");
for(i=0;i<400;i++)
{
CreateActor("Map","MapTiles",TileX[i],TileY[i],true);
Map.animpos=TileAnimpos[i];
}
}
-) Map=>CreateActor=>ScriptEditor :
- Code: Select all
ChangeAnimationDirection("Event Actor",STOPPED);
//crucial code for tiles
Any question ???