Background - I've decided to start making an SRPG in Sphere (there is a 90+% chance I'll never finish it but hey...)
I'd like to have what I call a "spinning ring" as a selection cursor. This is an ellipse rolling up and down on its side - obviously I'd do this in some kind of render script but to show what this ought to look like here's some example code that simply draws the ring:
function draw_ring(x, y, a, b)
{
var ring_s = CreateSurface(2*a + 5,2*b + 5,transparent);
for(var i = 0, t_x = 0, t_y = 0; i < 200; ++i)
{
t_x = a * Math.cos(i*Math.PI/100) + a;
t_y = b * Math.sin(i*Math.PI/100) + b;
ring_s.setPixel(t_x, t_y, red);
ring_s.setPixel(t_x + 1, t_y, red);
ring_s.setPixel(t_x, t_y + 1, red);
ring_s.setPixel(t_x - 1, t_y, red);
ring_s.setPixel(t_x, t_y -1, red);
}
var ring = ring_s.createImage();
for(i = 0; i < 800; ++ i)
{
ring.transformBlit(x ,//X1
y + b * Math.cos(i * Math.PI/100),//Y1
x + a ,//X2
y + b * Math.sin(i * Math.PI/100),//Y2
x + a ,//X3
y + b / 2 - b * Math.cos(i * Math.PI/100),//Y3
x ,//X4
y + b / 2 - b * Math.sin(i * Math.PI/100)); //Y4
FlipScreen();
}
}
Note: I do not expect any part of the above to be final except perhaps the image creation at the top - but this does show what the spinning ring should look like. (note I probably should change this to use the ellipse functions rather than the loop of points though I couldn't immediately see how to do a multi-thickness outlined ellipse particularly not in minisphere which seems to have not implemented the ellipse functions)
Now the problem:
1. from looking at that code (or trying it out) you'll soon see that sometimes the front of the ring is at the top and sometimes the back is at the top.
2. Imagine you have a sprite and this ring is around their feet - you want the front to show in front of them and the back not to. The only ways I can currently think of to do this are to have two seperate images, one for the back half which is drawn before the sprite and one for the front half which is drawn after the sprite - this seems a tad painful
Does anyone have any suggestions of ways to make this better?