Please look at the attached CAPX file to see what I mean. Currently the enemy tank is set up to move towards player 1 (controlled by arrow keys) when player one is in line of site. I have two issues:
1) The tank often moves through the solid walls instead of going around
2) Sometimes only one enemy tank seems to discover player 1
Because the process is temperamental you may need to refresh the screen a couple of times until you see it happen.
I haven't looked at you're capx yet, but make sure that solid walls have solid behavior. and for tanks attacking you got to make them to be a group trough variable and then with events make that group move together if one of them has player in sight.
Also I found that for stability it's best to re-build your obstacle scene on start of layout.
Hi, the walls have solid behaviours enabled but the enemy tanks still go through them.
I have re-uploaded the CAPX file as the original had a bug w.r.t. movements.
Develop games in your browser. Powerful, performant & highly capable.
You are calling Has line of site & Find path every tick - that won't work. It takes more than a tick for the find to kick in. Add "Every 1 second" to "Has LOS" and you'll see it works much better.
Thanks for that but my real problem is that the red tanks sometimes drive through the walls. Any ideas as to why that happens?
Does it do it after my suggestion?
Ok.. I understand... yeah that fixed it. Thanks
I answered too quickly.. It still goes through the walls.. will up load updated CAPX now
Just to note, the red tanks respawn when they land in the middle of a wall - this is a simply way to make sure that they respawn off the the walls.
However when they drive around they go through the walls and are therefore respawned.
I think this has to due with your cell size. Your walls/blocks are multiples of 44(ish) but your pathfinding cells are 30+6, so 40. I would suggest sizing everything appropriately, turning on the grid, aligning with the grid, so that everything is lined up with the grid. Reread the documentation on the cell mechanism. I did a quick experiment and it did seem to improve (I did see the overlaps you were seeing prior to these changes.)