Good morning to all Agser!
I have a gGui2 with his graphic that match with a DynamicSprite to get the screen totally black..
Secondly, i draw a circle at the foot of the character to fill a part of the black screen..
just like in the picture :
(http://imageshack.com/a/img840/6863/kfz.png)
Thirdly, i draw a rectangle to improvise a stream of light that follow the circle distance..
like this :
(http://imageshack.com/a/img849/5260/u7hw.png)
I'm here to ask for an opinion from all of you,
now my intention are as follow : how can I tilt the rectangle when the mouse goes above or below ?
I edited the picture for you to notice what I would do :
(http://imageshack.com/a/img853/6971/6ldm.png)
Could someone help me with this ?
For all eventualities, I will post the code here
DynamicSprite *dark;
int lightx[220],
lighty[220],
radius[220];
int count;
export count;
void Light(int i, int x, int y, int r)
{
lightx[i] = x;
lighty[i] = y;
radius[i] = r;
}
function Darkness()
{
dark = DynamicSprite.Create(System.ViewportWidth, System.ViewportHeight);
DrawingSurface *surface = dark.GetDrawingSurface();
DrawingSurface *surface2 = dark.GetDrawingSurface();
surface.Clear(0);
surface.DrawingColor = COLOR_TRANSPARENT;
surface2.Clear(0);
surface2.DrawingColor = COLOR_TRANSPARENT;
int x1 = GetViewportX();
int y2 = GetViewportY();
int i = 0;
while (i < count) {
if (right) surface.DrawCircle(lightx[i] - x1, lighty[i] - y2, radius[i]);
i++;
}
if (right) surface.DrawCircle(mouse.x+3, mouse.y - y2 - 40, 90);
else if (left) surface.DrawCircle(mouse.x-3, mouse.y - y2 -40, 90);
surface2.DrawRectangle(mouse.x, player.y-70, player.x+5, 70- player.BlockingWidth+150);
surface.Release();
surface2.Release();
gGui2.BackgroundGraphic = dark.Graphic;
}
Thanks to all of you who are reading the message
Try with a dummy line with a big thickness:
surface.DrawLine(x1,y1,x2,y2,thickness);
By the way, unless i'm missing something I dont see the need of using 2 different surfaces.
Thanks Joe for answering
Quote
Try with a dummy line with a big thickness:
surface.DrawLine(x1,y1,x2,y2,thickness);
Well, I have tried many methods but it does not seem that this could help my request..
i guess it must be the same rectangle that do the stream of light, not a different line again
Just compiled a test game with this code in the room script and it works...
DynamicSprite* dark;
function room_RepExec()
{
dark = DynamicSprite.Create(System.ViewportWidth, System.ViewportHeight);
DrawingSurface *surface = dark.GetDrawingSurface();
surface.Clear(0);
surface.DrawingColor = COLOR_TRANSPARENT;
int x1 = GetViewportX();
int y2 = GetViewportY();
surface.DrawCircle(mouse.x, mouse.y - y2, 40);
surface.DrawLine(mouse.x, mouse.y, player.x, player.y-20, 20);
surface.Release();
gGui2.BackgroundGraphic = dark.Graphic;
}
Aaaaahh ! This is Fantastic ! ;-D
Congratulations Joe ! :)
I'm Sorry i misunderstood your intentions !
Cheers from Italy and thank you again :P