This is the ring area that I am talking about (marked in purple):

I achieved this by using the good old circle equation:

x

Example

I simply inserted the X and Y coordinates of the particles into the function, switched the '=' with a > and for the radius I used the inner edge of the ring.

what you get is this. The next step was to limit the area from the outside, so I added the same equation, enlarged the size of the radius(by the width of the pad) and switch the '>' with a '<'. and I got me a lovely ring. The third condition requires the particle sprite to have the same angle as the pad and the whole thing works!

Well... it almost works. The real problem arises here. Spinning the pad and the particles around reqires the use of the dbWrapValue(Value) (a Dark GDK function), wich wraps the value of the angle (it doesn't let a value go out of the bounds of 0°-359° for example 359°+10°=9° instead of 369°). This caused a problem at the top of the game area (where the angle is 0°) If the pad was on the left side of the 0° mark and the particle was on the right like this:

The pad value was something like 355° and the particle value was for example 3°. Those values are far apart, so I had to make an exeption and make a separate collision function for values that revolved around the 0° mark where the values get wraped. It works perfectly now.

^{2}+ y^{2}= radius^{2}Example

I simply inserted the X and Y coordinates of the particles into the function, switched the '=' with a > and for the radius I used the inner edge of the ring.

what you get is this. The next step was to limit the area from the outside, so I added the same equation, enlarged the size of the radius(by the width of the pad) and switch the '>' with a '<'. and I got me a lovely ring. The third condition requires the particle sprite to have the same angle as the pad and the whole thing works!

Well... it almost works. The real problem arises here. Spinning the pad and the particles around reqires the use of the dbWrapValue(Value) (a Dark GDK function), wich wraps the value of the angle (it doesn't let a value go out of the bounds of 0°-359° for example 359°+10°=9° instead of 369°). This caused a problem at the top of the game area (where the angle is 0°) If the pad was on the left side of the 0° mark and the particle was on the right like this:

The pad value was something like 355° and the particle value was for example 3°. Those values are far apart, so I had to make an exeption and make a separate collision function for values that revolved around the 0° mark where the values get wraped. It works perfectly now.

## No comments:

## Post a Comment