Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-28-2012, 10:59 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
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'?
Reply With Quote
  #2  
Old 05-28-2012, 11:19 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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);
  }

__________________
Quote:
Reply With Quote
  #3  
Old 05-28-2012, 11:26 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
You can use a gani, as the setshape starts at 0,0 in a gani(the topleft of the green box).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:18 PM.


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