HI, i am trying to to get an image to display when a hotspot is clicked which is working fine, but i want it to disappear again on another click of the mouse like when a Display string does.
I am using the DrawingSurface DrawImage function...
Are you drawing the image to the background?
Make a backup of the background, then restore it.
// top of room script
DynamicSprite*backup;
// before drawing the image:
backup = DynamicSprite.CreateFromBackground();
Then just draw backup to the background after the click.
There are other ways to temporarily display an image though, it depends on whether you want the image to appear on top of characters/objects or below them.
Check out Overlay.CreateGraphical (http://www.adventuregamestudio.co.uk/manual/Overlay.CreateGraphical.htm).
Variables:
Hotspot*check;
DrawingSurface *surface,backup;
bool drawn;
function on_mouse_click (MouseButton button)
{
if (button==eMouseLeft)
{
check=Hotspot.GetAtScreen(mouse.x,mouse.y);
if (check==null || check.ID==0 || drawn) {
surface.DrawSurface(backup);
backup.Release();
surface.Release();
drawn=false;
}
else
{
surface = Room.GetDrawingSurfaceForBackground();
backup = thesurfaceyourealreadydrawingtogoeshere.CreateCopy();
surface.DrawImage(bla bla bla whatever you have already)
drawn=true;
}
}
}