Hey!
im trying to figure out a formula on how to spawn objects around a circle. i need it to be random X,Y but at a fixed interval in distance.
so i want the red sprites to only spawn inside in the grey band. any ideas?
PS. the grey band is not an actual sprite, only a visual example of the formula im looking for.
Develop games in your browser. Powerful, performant & highly capable.
You may generate random X,Y coordinates and check whether they are inside an area or not. For instance, you can use the "distance" function and it should be between 2 values. Keep generating coordinates until they are in =)
hmm ye that might work, thanks! i was trying to use a cos/sin but math > me =)
tried your solution but i think i solved it another way:
created object at circle.x, circle.y
move object random(500,600) at angle random(0,360)
repeat as many times as i need... did kind of work.
Great! It is nice that there are many ways to achieve a goal! =)