I am attempting to make a small browser game that works like the tron lightcycles. After many attempts I finally got the shape painter to make a small trail behind the player, but now I realize it might not be possible to tell if the player has crossed over their previous path. Screenshots below. Thank you in advance for any assistance.
Sorry I forgot to say what the problem was for those that might not know tron. I need the player to lose when they run over their own tail or the tail of another bike and I don’t know how to do that
When you draw the line, you could also place an hidden circle sprite the size of the line thickness, and check for player collision with that hidden sprite.
Would this create a lag issue if the lines don’t fade away over time? I want the trail to stay up as long as the round is going.
What if you used the read pixels extension to check if a point ahead of the bike isn’t the background color. If the bikes are snapped to a grid then checking a point ahead of the bike and in the center should be enough. Otherwise, you might need to check 2 points. Both in front of the bike, one on the top and one on the bottom. You could setup points on the object. The point rotate with the bike, so they would always be ahead of the bike.
https://wiki.gdevelop.io/gdevelop5/extensions/read-pixels/
You would need to know the red, green, blue values of the background and then check if the rgb isn’t those values.
I also like the idea of a hidden object or place visible objects instead of the shape painter. Just lock the player to a grid and use objects the size of the grid as it moves from grid to grid.
Only a small part of the bike would need a collision mask.
You could even use a tilemap and change the tiles as the bike goes from grid to grid.