Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   positioning for everyone (https://forums.graalonline.com/forums/showthread.php?t=134266154)

r3ckless 04-02-2012 04:59 PM

positioning for everyone
 
Hey guys I'm trying to setup a custom HP HUD. I'm having trouble with placement on screen though. I'm using screenheight/width, but when I line it up perfect on my screen, its not perfect for everyone else. How would I go about doing this correctly?

This is a part of what I have:

PHP Code:

function ShowHP_Bar()
{
with (findimg(250)) {
image "bigheart.png";
    
screenwidth-200;
    
screenheight-540;
    
partw 40;
    
parth 44;
    
layer 4;
   }



cbk1994 04-02-2012 05:06 PM

You're trying to get it to show in the bottom right of the screen? That looks about right. Otherwise change the x/y values—you only need the screen's width/height if you're at the right/bottom.

Mark Sir Link 04-02-2012 05:46 PM

How did you decide the values of 200 and 540? If you want it to be exactly in the corner, you'd only have to subtract the height/width of the image itself.

r3ckless 04-02-2012 05:56 PM

1 Attachment(s)
I want it to be at the top right somewhat. Here is a screenshot of what the said code gave me

fowlplay4 04-02-2012 07:10 PM

You don't need to use screenheight when you're working from the top, just using a 10 or 20 y value for example will get you what you're looking for.

r3ckless 04-02-2012 09:50 PM

ah, thanks fp :)

r3ckless 04-02-2012 09:52 PM

How would I go about the x axis though, not everybody's screen is the same size...

Crow 04-02-2012 10:14 PM

Quote:

Originally Posted by r3ckless (Post 1690873)
How would I go about the x axis though, not everybody's screen is the same size...

You already got that right in your first post. Use screenwidth and then subtract.

r3ckless 04-02-2012 11:55 PM

Thanks guys :)

Hezzy002 04-03-2012 01:17 PM

Quote:

Originally Posted by Crow (Post 1690874)
You already got that right in your first post. Use screenwidth and then subtract.

It looks like he wants it centered, though, so he'd have to do something more akin to:

screenwidth / 2 - width_of_hpbar / 2

Crow 04-03-2012 05:07 PM

Quote:

Originally Posted by Hezzy002 (Post 1690946)
It looks like he wants it centered, though, so he'd have to do something more akin to:

screenwidth / 2 - width_of_hpbar / 2

Quote:

Originally Posted by r3ckless (Post 1690825)
I want it to be at the top right somewhat. Here is a screenshot of what the said code gave me

Going by what he posted earlier, I don't think he wants it centered :p Still, good point to make.

Hezzy002 04-03-2012 05:20 PM

Looked centered in the screenie..

Angel_Light 04-04-2012 05:01 AM

Quote:

Originally Posted by Hezzy002 (Post 1690946)
It looks like he wants it centered, though, so he'd have to do something more akin to:

screenwidth / 2 - width_of_hpbar / 2

simplify!

x = (screenwidth - IMG_WIDTH) / 2;

That's all :P

If you want it to be to the right then wrap that in quotes then + (whatever offset from center). Also make sure to re set values when the screen is resized.

r3ckless 04-04-2012 09:59 PM

thanks guys, i wanted it on the left side. But i figured it out from what you guys said.


All times are GMT +2. The time now is 05:40 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.