http://greatflash.co.uk/index.php?topic=471.0 (Link to original)
This was in turn a partial version of Boulder Dash.
So, all is working in unity with a full editor built in and support for mobile as well as desktop.
The game works a little different than most Boulder Dash clones in that all objects move in pixels rather than blocks. This includes our titular hero 'Balders'. The other difference is that Balders does not need to wait for a cave refresh until he can move, he can do so at any time.
The game has both Boulder Dash I & II built in. This was not because I intended to emulate or remake Boulder Dash, but I had gone so far that it seemed silly not to. These all work perfectly (except - see below) and permeability is working fine as well. I have also added Arno's Dash 1 into the mix for testing. (You can create individual levels and then combine them into a single Game Set for distribution and sharing).
Any hoo...
I have a couple of problems (will post about the others if I cannot fix them). The first being the Amoeba growth. We see this defined as two rates. Normal with a 4/128 chance and fast with a 4/16. I have equivocated them to 1/16 and 1/4. So a rand from 0-15 if a 0 is returned - grow an Amoeba.
But, my Amoeba does not grow the same as in boulder dash? It appears much slower?
The cave is scanned at precise times (the time it takes for an object to pixel move one tile - they all move together). If an Amoeba is found during the scan, a check to see if it can move is made.
The code works like this...
Find out if it is allowed to grow and also get a random direction to grow in.
Code: Select all
bool grow = Random.Range(0, (m_blobStatus == TileObjectStatus.TILE_OBJECT_STATUS_NORMAL ? Globals.BLOB_SLOW_RANGE : Globals.BLOB_FAST_RANGE )) == 0;
Global_Direction dir = (Global_Direction)Random.Range(1,5);
We then do this on each possible direction,
Code: Select all
if (y+1 >= Globals.LEVEL_MAP_SIZE.y) trapCount++; // up
else if (TileMap.GetTileStatus(x,y+1) != TileStatus.TILE_STATUS_RESERVED)
{
tileType = TileMapData.TileScript[x,y+1].GetTileType();
if ((tileType != TileType.TILETYPE_NONE && tileType != TileType.TILETYPE_DIRT) || TileMap.GetTileStatus(x,y+1) == TileStatus.TILE_STATUS_PLAYER || TileMap.GetTileStatus(x,y+1) == TileStatus.TILE_STATUS_MIDMOVE)
trapCount ++;
else if (grow && dir == Global_Direction.DIRECTION_UP)
TileMapData.TileScript[x,y+1].SetTileAsset(x,y+1, TilesById.ID_BLOB, TileAnimType.TILE_ANIM_TYPE_GENERATE_GLOBAL, TileStatus.TILE_STATUS_RESERVED, TileStatus.TILE_STATUS_RESERVED, false, false, Global_Direction.DIRECTION_NONE, new Vector2 (x,y));
}
It first checks if it is trapped (ie. cannot move in any direction, and increments a trap counter, 4 = totally trapped). If totally trapped, the returned value (being 4) adds 1 to a counter, if the counter = number of amoeba, then they turn to diamonds. This works.
If the number of amoeba >= 200 (can be changed per level) then it turns to rocks. This works.
So, with the Amoeba, I have the one problem mentioned above. I really don't know how to fix it?
In the original, the cave scan is after a delay (cave speed) and should be doing the same as my code. My code (because the game is intended to be silky smooth at all cave speeds) moves in pixels as part of a tile. ie. if the tile is 60 pixels square, the amount of moves at speed 5 (default) is 60/5 = 12. So, for ever 12 updates of the code, the cave scan is called and the amoebas will move (if the random number is in their favour and the given direction is free). As far as I can see, this is the same as the original. but.. take a default speed in the original, ie. a delay of 8. This would mean 8 updates per cave scan, mine is (default) every 12 scans. This should not make any difference as the movement is the same. BD's 8 is the same as my 12 in as much as an object moves the same distance.
Any help would be really appreciated as this is driving me nuts. It wasn't my intention to replicate BD initially, but it would be nice.
Everything else is working fine except a couple of minor niggles that I will perhaps post later. (and will have to set up some image sharing so I can post some pictures).