Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 04:54 PM.


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