View Single Post
  #1  
Old 02-26-2013, 03:02 PM
Hoyt1134 Hoyt1134 is offline
Registered User
Join Date: Jul 2004
Posts: 18
Hoyt1134 is on a distinguished road
Error with polygons drawing lines

I have run into an unusual bug with drawing polygons on the latest version (6.037) of the Windows client. When drawing a polygon with only 2 points, its x and y positions are offset by 0.5 tiles. If you attempt to draw a polygon with the coordinates {20, 20, 25, 25} it will instead draw it at {20.5, 20.5, 25.5, 25.5} and also move the rightmost pixel up by 1 pixel. This doesn't seem to affect polygons with more than 2 points or images though. Here is the code I used to test with:

PHP Code:
//#CLIENTSIDE
function onMouseDown(){
 
temp.imageX=mousex;
 
temp.imageY=mousey;

//Block image
 
with(findimg(200)){
  
image="block.png";
  
x=temp.imageX;
  
y=temp.imageY;
  
layer=0;
 }

//Green triangle 2-D polygon
 
with(findimg(201)){
  
polygon={
   
temp.imageX,temp.imageY,
   
temp.imageX+2,temp.imageY,
   
temp.imageX+2,temp.imageY+2
  
};
  
layer=1;
  
red=0;
  
green=1;
  
blue=0;
 }

//Red line 1-D polygon
 
with(findimg(202)){
  
polygon={
   
temp.imageX,temp.imageY,
   
temp.imageX+2,temp.imageY
  
};
  
layer=2;
  
red=1;
  
green=0;
  
blue=0;
 }

And here is an image of the results:


The red line should line up with the top edge of the green triangle and the block image, but instead it is shifted down and to the right, and the rightmost pixel is raised up.
Reply With Quote