Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-21-2008, 10:48 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
drawLine()

PHP Code:
//#CLIENTSIDE
public function drawLine(indexxy1xy2colorthicknesslayer) {
  
with(findimg(index)) {
    
polygon = {
      
xy1[0], xy2[1], xy2[0], xy1[1],
      
xy2[0]+thicknessxy1[1]+thicknessxy1[0]+thicknessxy2[1]+thickness
    
};
    
layer layer;
    
red color[0];
    
green color[1];
    
blue color[2];
    
alpha color[3];
  }

Basic example:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
drawLine(200, {1520}, {3118}, {1000.99}, 0.32);
  
// will draw a red line from 15,20 to 31,18 with a thickness of 0.3 tiles

Basicly you give the function: index, xy1[], xy2[], color[], thickness and layer

The function will draw polygon from xy1 to xy2, thickness of the line is based on the 4th param (if layer is 4 or lower, it is given in tiles. If 5 or higher thickness is in pixels (This goes to coordinats to (xy1 and xy2))

A nifty little function that I thought I could share
__________________

Last edited by Chompy; 01-21-2008 at 11:11 PM..
Reply With Quote
 


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 08:23 PM.


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