![]() |
setimg/setimgpart? offset
Is there any way to set where the img starts (in pixels) relative to the NPC? I'd like to use setimgpart() but basically do:
setimgpart("image.png",-10,0,width,height); to give the image a transparent border on the left of 10px. Is this at all possible? I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level. Is this possible? Thanks. |
Quote:
worldx(screenx, screeny); worldy(screenx, screeny); To convert screen coordinates to level coordinates. |
Quote:
|
Quote:
Converts things such as mousex and mousey to level coordinates. |
Quote:
Each function takes two screen coordinates (an x and a y), then returns the level x or y (depending on the function). Play around with it.... PHP Code:
I'm not entirely sure about gmap behavior though, but those can be easily converted too. Quote:
|
Quote:
Not sure actually. How we normally make checks it would appear to be the position in the level, but I double checked and looked at the worldx/worldy descriptions and they stated that mousex was screen position, which ultimately wouldn't make much sense. The worldx description and the mousex description state that they are two different things x-x |
mousex/y is in level coordinates, though it may give different values than worldx/y. mousex/y may only be relative to a flat gmap (I don't think so, but maybe...) whereas worldx/y varies depending on the terrain, and thus the need for both x and y parameters.
|
ah, I get it, Thanks Napo
|
Quote:
One tile is 16x16 pixels, so if you want to move it a pixel on the level space, you move it by 1/16 tiles, which is equal to one pixel =) |
Quote:
|
Quote:
" I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level." He only looked at the showimgpart as an alternative because he didnt know how to move it by pixel on the level layer (showimgpart allows a pixel manipulation on this layer, so he thought it was the way to go). |
Quote:
PHP Code:
|
Can things be moved by small amounts like 1px serverside though?
I cant seem to get anything to move that little. |
Quote:
|
Well it's actually part of an NPC. I'm using setimgpart() to show part of an npc but i need the npc to move slightly.
|
Quote:
|
Maybe display the image with an index below 200 instead of using a serverside script? Well, maybe you are already doing this, not sure.
|
Quote:
I guess i'll have to use showimg to do it. Edit: do serverside showanis have a accuracy of .5 tiles too? I'm doing showanis with indexes < 200 and clientside they look fine but for everyone else they're in the wrong place (rounded to .5 tiles by the looks of it) |
Quote:
Well, you can always set the img to a blank img on the serverside via setimg(). |
Quote:
If the gani sprites are positioned correctly, then all you have to do is use setcharprop. |
Quote:
if its opening, use an ani instead, so the opening animation looks smooth. you shouldnt be looping an npc animation serverside, which im assuming youre trying to do if its pixel by pixel |
| All times are GMT +2. The time now is 09:10 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.