Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shaun9991 on Tue 10/01/2017 12:18:50

Title: Setting custom Dialog GUI position based on players Y-position
Post by: shaun9991 on Tue 10/01/2017 12:18:50
Hi guys,

I hope this is a simple question, any assistance is much appreciated. I have a custom dialog GUI (gSaying) for my main character, I'd like to test the dialog GUI (including the labels and portrait button) to appear at the top of the screen when the player is in the lower half of the screen, or the bottom of the screen when the player is at the top of the screen. I'm hoping I can do this with a simple if/else when calling the custom dialog GUI? Just not sure how to go about it. Note that the game features scrolling screens, some of which scroll up and down as well as left and right. The game res is 640x400. Any help much appreciated!

Thanks,

Shaun
Title: Re: Setting custom Dialog GUI position based on players Y-position
Post by: Khris on Tue 10/01/2017 12:45:59
You can calculate the player's screen position by subtracting GetViewportY() from player.y.
As for positioning the dialog GUI, the forum search gave this result: http://www.adventuregamestudio.co.uk/forums/index.php?topic=46705.msg628388#msg628388
Title: Re: Setting custom Dialog GUI position based on players Y-position
Post by: shaun9991 on Tue 10/01/2017 13:52:38
Thanks Khris, I'll try this out tonight! :)