Author Topic: Floating GUI for names of objects and characters flashing from left to right  (Read 126 times)

Hello again adventure folks!

I've tried to implement a "floating" GUI to display the names of objects and characters, for what I've used the following code by Khris from this thread:

The code is the following, under the function repeatedly_execute section in the Global Script:

Code: Adventure Game Studio
  1.   int x = mouse.x + 3;
  2.   int y = mouse.y + 5;
  3.   InventoryItem*ii = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
  4.   Label*lbl = gLocationName.Controls[0].AsLabel;
  5.   String text;
  6.   if (ii) text = ii.Name;
  7.   else text = Game.GetLocationName(mouse.x, mouse.y);
  8.   if (x > 250) x = (x - 6) - GetTextWidth(text, lbl.Font);
  9.   gLocationName.SetPosition(x, y);

For now, it has worked, but I find a little annoying problem: names display normally on the left side of the cursor, but happen to "flash" randomly on the right side, for less than a second. I'd like to know if it's possible to "block" the names on a fixed position relative to the cursor, so this flashing stops happening.

Thanks to Khris for the original code, and to everyone in advance for any tip! :)
« Last Edit: 11 Feb 2019, 23:14 by Innsmouthian »