> > CapX:
> > https://dl.dropboxusercontent.com/u/109921357/Collision%20test%203/Collision_test.capx
1) It is strange but when I shoot at the TilemapBoxEnemy, i got Tilemap1 cells generated around it instead of replacing a tile of TilemapBoxEnemy with a tile of Tilemap1. "Text" indicates if there are some log changes.
Before shooting with Bullet2Player
After shooting with Bullet2Player
Here is my code
Object coordinates defined and converted
Bullet coordinates defined and converted
2) I would want actually to complicate even more the code by adding another sub condition with comparing instance variables.
Visually, it would work in that way:
The bullet2Player overlaps TilemapBoxEnemy.
If there is a TurretBody around a tile of TilemapBoxEnemy, the bullet2Player is just destroyed.
If there is no any TurretBody around a tile of TilemapBoxEnemy, the bullet2Player is destroyed and we check if any Tilemap1 tiles surround a tile of TilemapBoxEnemy. Depending on the location of Tilemap1 tiles we set different tiles to tile of TilemapBoxEnemy. For instance, there is a tilemap1 (X, Y+1 ) in relation to a tile (X, Y) of a TilemapBoxEnemy, so a tilemap1 or tilemap4 replaces randomly an overlapped tile of TilemapBoxEnemy.
Tilemap1 replaces a tile.
Tilemap4 replaces a tile
or any other tilemap replaces a tile indicated in a random basket of tilemaps. Here I wonder how can we control a random frequency of a particular tilemap appearance.
So the code of the additional sub condition is the following
To continue a topic about random tilemaps,
let's say we created the level which consists of arranged tiles of Tilemap1.
Can we on start of layout to set random tiles of other Tilemaps to Tilemap1?
For Instance, on start of layout some tiles were changed
Here, we should again to check for location of tiles around each tile of Tilemap1. If any of 5 conditions 1)X,Y+1 2)X+1, Y 3) X-1, Y 4) X, Y-1 5) else is satisfied, we would set particular tilemaps to a tile (X,Y) .
The problem is that there is no overlapping here, no interaction with a tilemap1. How can we randomly distribute tiles of many different tilemaps on a tilemap1 without knowing the coordinates of each tile?