Crimson - I recall the gui was waaaay over to the right hand side for some reason (if I knew, I can't remember now), and you'll see the initial adjustment is minus 198, and when it's less than 50 on x, it's minus 90, which is a less amount than 198. Maybe that's what it was? I mean, if I hover the cursor on something to the edge of the left hand side of the screen (apart from the inventory cursor), the text gui has moved to the right.
Khris - Okay thanks I'll try again. Yeah x is still a declared variable somewhere else, which I cannot find. Oh, you put ) brackets near the end of lines 7 and 10 so I deleted those. I replaced x with Posx.
Okay, so I can get the game to run with Khris' code:
Code: ags
I think I've messed up my @overhotspot@ properties. I'm going to start a new project and see what its width is for both the label and main gui. Perhaps when I changed my project's resolution from the default, I needed to change this too?
Khris - Okay thanks I'll try again. Yeah x is still a declared variable somewhere else, which I cannot find. Oh, you put ) brackets near the end of lines 7 and 10 so I deleted those. I replaced x with Posx.
Okay, so I can get the game to run with Khris' code:
function repeatedly_execute()
{
gOverhotspot.Visible = true;
// calculate coordinates assuming for now that GUI doesn't have to be moved
int Posx = mouse.x - 0; int Posy = mouse.y - 0;
// horizontal check
if (x < 0) Posx = 0;
if (Posx + gOverhotspot.Width > System.ViewportWidth) Posx = System.ViewportWidth - gOverhotspot.Width;
// vertical check
if (y < 0) Posy = 0;
if (Posy + gOverhotspot.Height > System.ViewportHeight) Posy = System.ViewportHeight - gOverhotspot.Height;
// finally, actually move GUI there
gOverhotspot.SetPosition(Posx, Posy);
}
I think I've messed up my @overhotspot@ properties. I'm going to start a new project and see what its width is for both the label and main gui. Perhaps when I changed my project's resolution from the default, I needed to change this too?