Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old 01-24-2008, 06:43 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
findimg() vs. showimg() is just a matter from preference. one isn't more OO than the other; one isn't more 'GS2' than the other. they are pretty much equivalent.

For example, taking
Quote:
Originally Posted by Kristi View Post
showimg is a fine function. I personally do something like
this.whatevz = showimg(whatevz);
then generally reference the variable when i want to change anything
this.whatevz.red = rad;
i would do something along the lines of:
PHP Code:
with (findimg(1)) {
  
//whatevz
  
thiso.whatevz this;

but either way is just as good.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #32  
Old 03-13-2009, 11:58 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
I came across this thread when trying to find out if there was a built in drawLine() function. However, I needed the width of the line to be the same regardless of angle and made this:

PHP Code:
//DrawLine( img_index, start_x, start_y, target_x, target_y, width_in_tiles, red, green, blue, alpha)
public function DrawLineindsxsytxtywidrgbalph ) {
  
temp.ang getangle(tx sxty sy) + (pi/2);
  
temp.wid = ( wid == NULL .1 wid );

  
with findImg(ind) ) {
    
polygon = {
      
sxsy,
      
txty,
      
tx cos(ang)*widty sin(ang)*wid,
      
sx cos(ang)*widsy sin(ang)*wid
    
};
    
red = ( || );
    
green = ( || );
    
blue = ( || );
    
alpha = ( alph <= || alph alph);
    
layer 3;
  }

An example:
PHP Code:
DrawLine(20025254545);
//Draws a black line of width .1 tiles from 25,25 to 45,45 
or if you want to specify color, width and alpha:
PHP Code:
DrawLine(20025254545.3100.5);
//Draws a semi-transparent red line of width .3 tiles from 25,25 to 45,45 
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:01 AM.


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