View Single Post
  #4  
Old 01-05-2012, 07:14 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
Something like this should work...

Calculate the distance between the two positions and that will give you roughly how many images you need to draw if each image is one title in width and height (16x16).

Calculate the delta x, y (final - initial)

For image = 1; image <= images; image++

Show image at x + (delta x * (image / images)), y + (delta y * (image / images))
Have been messing around with something like this:

PHP Code:
//#CLIENTSIDE
function onCreated()
  
onTimeOut();
function 
onTimeOut() {
  if (
leftmousebutton) {
    
temp.img "wmace0.png";  //image to draw
    
temp.distx player.mousex;  //x distance
    
temp.disty player.mousey;  //y distance
    
temp.lennew = (temp.distx^temp.disty^2) ^ 0.5;  //length in tiles
    
player.chat temp.lennew;  //debug
    
for(temp.0temp.<= temp.lennewtemp.i++) {
      
temp.indx ++;
      
temp.newpos temp.i/16*9;
      
player.chat newpos;
      
with (findimg(200+temp.indx)) {
        
player.x+temp.newpos;
        
player.y;
        
image temp.img;
      }
    }
  }
  
settimer(0.05);

It seems to work, but itīs not exactly on the mousex. How could that get fixed?
__________________
MEEP!
Reply With Quote