Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   setShape Problem (https://forums.graalonline.com/forums/showthread.php?t=134266531)

blackbeltben 05-28-2012 10:59 PM

setShape Problem
 
Useing the this.setShape() function, is there a way to move the image within that box?

this.setshape(1, 80, 80);

It works for below it, and of the right of it, but is there a way to center the image in the '80' '80'?

fowlplay4 05-28-2012 11:19 PM

Not the way you want it, but I wish there was an easy way to offset the position of the shape/npc.

You have to use showimg to draw the image within that box, then you can use some simple math to determine the center position ((max_width - width) / 2). I.e.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setshape(1,80,80);
  
drawBlock();
}

function 
drawBlock() {
  
temp.shapewidth 80 16// Converting the width from pixels to tiles
  
temp.shapeheight 80 16;
  
temp.blockwidth 32 16;
  
temp.blockheight 32 16;
  
with (findimg(200)) {
    
image "block.png";
    
thiso.+ ((temp.shapewidth temp.blockwidth) / 2);
    
thiso.+ ((temp.shapeheight temp.blockheight) / 2);
  }



DustyPorViva 05-28-2012 11:26 PM

You can use a gani, as the setshape starts at 0,0 in a gani(the topleft of the green box).


All times are GMT +2. The time now is 10:32 PM.

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