Set GUI position in relation to character

Started by Lewis, Tue 05/11/2013 07:46:27

Previous topic - Next topic

Lewis

Hiya.

So imagine if you could have a super-swish GUI pop up in relation to the position of a character. How would one go about doing this?

It seems to me that the issue is GUI positions being based on screen coordinates whereas character positions are based on room coordinates. So

Code: ags
gGUI1.X=cCHAR1.x+15;
gGUI1.Y=cCHAR1.y-15;
gGUI1.Visible=true;


doesn't manage to display the GUI at all.

Any help appreciated. Ta!
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

Crimson Wizard

Whenever you want to convert room coordinates to screen coordinates, use Viewport:

Code: ags

gGUI1.X = cCHAR1.x - GetViewportX() + 15;
gGUI1.Y = cCHAR1.y - GetViewportY() - 15;

Andail

It seems strange that it won't display at all. How is it triggered? Is it supposed to follow the character around, using repeatedly_execute () ?
Viewport is only a position issue in scrolling rooms, it shouldn't prevent it from displaying completely.

Crimson Wizard

Quote from: Andail on Tue 05/11/2013 08:16:30
It seems strange that it won't display at all.
Right... maybe the GUI type is incompatible with this task, like "popup when mouse is at Y"?

Lewis

I could get the GUI to pop up when I specified just room coordinates, but when character coordinates were specified it didn't appear anywhere.

At least, it didn't *seem* to. There's a slight chance I was a massive idiot and it was displaying off-screen, as it's a scrolling room.

I'll check this when I get back from the office later on. Thanks folks!
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

SMF spam blocked by CleanTalk