I'm currently trying to script a laser beam, in the style of Shoop Da Whoop.
However, hitobjects only hits the player directly in front of me, rather than along the line of reference (the showpoly). I've tried fiddling with the range and the number of times it calls hitobjects() (9.5/8), to no avail.
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
//setani("kirble-dama-shoopdawhoop", NULL);
//sleep(3);
for (i = 9.5/4; i =< 9.5; i += (9.5/8)) {
temp.posi_x = player.x + 1.5 + vecx(player.dir) * i;
temp.posi_y = player.y + 1 + vecy(player.dir) * i;
showpoly(1234, {
player.x + 1.5 + vecx(player.dir),
player.y + 1 + vecy(player.dir),
temp.posi_x,
temp.posi_y
}
);
hitobjects(0.5, temp.posi_x, temp.posi_y);
}
}
Does anybody have any ideas on how I'd fix this?