Quote:
Originally Posted by fowlplay4
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.x - mousex; //x distance
temp.disty = player.y - mousey; //y distance
temp.lennew = (temp.distx^2 + temp.disty^2) ^ 0.5; //length in tiles
player.chat = temp.lennew; //debug
for(temp.i = 0; temp.i <= temp.lennew; temp.i++) {
temp.indx ++;
temp.newpos = temp.i/16*9;
player.chat = newpos;
with (findimg(200+temp.indx)) {
x = player.x+temp.newpos;
y = 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?