I am creating enemies on a random position on the layout, but sometimes, they create near my player or right over it. How do I prevent this? I want to spawn them on the layout but a few pixels away from my player sprite.
Thanks in advance!!!
Develop games in your browser. Powerful, performant & highly capable.
add another condition? Compare distance(x1, y1, x2, y2) ? system -> compare two values: distance(x1, y1, x2, y2) >400 etc...
You could generate your numbers using the following logic:
You must use only one of the condition at a time otherwise you will have something like this: