###

» Tue Feb 05, 2013 4:31 pm

__Global variable:__

random = 0

radius = 200

__Instance variable:__

Sprite2 (angleBetween = 0)

__Event:__

Every tick >

Set random to (random+1)

Sprite2 (Set position to (sun.X+cos(random)*radius, sun.Y+sin(random)*radius"))

Sprite2 (Set angleBetween to (angle(sun.X,sun.Y,Sprite2.X,Sprite2.Y))

*Here control the angle which you don't want object to spawn~*

For your case:

if Sprite2 (angleBetween <= 130) or (angleBetween >= 140)

Sprite2 spawn GreenDot on layer 0 (Image Point 0)

You may ask my angle is between 220 & 230~

But why the angle in the code is (<= 130) or (>= 140)~

That's because the calculation of angle(x1,x2,y1,y2)~

The return answer is between (-180 to 180 degrees)~

Start from opposite direction of the object~

Yup. That's it. Hope it help. (^_^)