I was wondering if it would be possible to create a gui that would apear right next to your player no matter what his location was. For example, lets say if you left click on your player a few buttons would appear over his head to allow a choice of interactions. I had to swith to a different gui design because this was a big hassle trying to code such a feature since I dont know how to offset the "animation scaling". In addition, is it possible to compare "gui.centre" to the center location of the player? Thanks.
Redbeard
GUI.Centre() moves the GUI back to the center of the screen.
What you need is a bit of code in the repeatedly_execute function of the global script:
Ã, GUI*g=NameOfYourGUI;Ã, // change accordingly
Ã, h=player.Scaling*[height]/100+5;Ã, // replace [height] with char sprite height, 5 is spacing
Ã, gNameOfGUI.SetPosition(player.x-GetViewPortX()-g.Width/2, player.y-h-g.Height);
Thanks for the quick reply, however I ran into a little snag:
GUI*g=gTest;Ã,Â
h=player.Scaling*[98]/100+5;Ã,Â
gTest.SetPosition(player.x-GetViewPortX()-g.Width/2, player.y-h-g.Height);
After I put this code into the rep_ex section of the global, I get this error: Undefined token 'h'
Sorry, my bad, put "int" before the h:
Ã, int h=player...
Ok now I get another error: Parse error in expr near '['
GUI*g=gTest;Ã,Â
int h=player.Scaling*[98]/100+5;Ã,Â
gTest.SetPosition(player.x-GetViewPortX()-g.Width/2, player.y-h-g.Height);
Ok, here's the whole thing, I hope this'll work now:
Ã, GUI*g=gTest;Ã,Â
Ã, h=player.Scaling*98/100+5;Ã, // no []
Ã, gTest.SetPosition(player.x-GetViewPortX()-g.Width/2, player.y-GetViewPortY()-h-g.Height);