This is how my code looks right now. It does'nt work at all.
I have a simple pathfinding system that says:
Is it my turn? if yes;
am i NOT next to the players pos and do i have "movement" left? if yes;
the "enemyalternativeroute()" func leads to the above mentioned code:
which has an IF or ELIF statement for each four directions (only working on 1 for now, for testing)
Here i make it move it's directional raycasts in an alternative direction (up/down instead of left in this case) and see if it will collide with anything if it tries moving (left) from there, and if so start moving towards that point instead.
This would allow it to overcome 1 "tile" worth of obstacles and i would be able to expand this formula up to any number of tiles.. i think.
But this doesn't work, it moves the raycast and it obviusly collides with the obstacle, yet it prints "false" when i ask if it has collided, and as such only takes the "north" direction and never the "south" even if the path is shorter.
I bet there is a much simpler way to do this... If so, I would LOVE to hear it.
Navmesh or polygoninstance and nav2d takes the corners and not the centers of my tiles, so I can't make that work either. (Tiles are 50x50pixels atm)
Any help is appreciated and congratz if you actually read all this nonsense and made sense of it :)