Quote:
Originally Posted by Angel_Light
cant you use the default ones or do want to see the script? I'm not sure hwo they do there bow probably just shootarrow and stuff here's how I would do bombs
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
if (player.bombs > 0) {
setani("lay", NULL);
freezeplayer(0.2);
if (isOnMap) {
temp.px = player.x - (64 * getMapX(player.level)) + 0.5 + vecx(player.dir)*2;
temp.py = player.y - (64 * getMapY(player.level)) + 0.5 + vecy(player.dir)*2;
putBomb(1, temp.px, temp.py);
}
else {
putbomb(1,player.x + vecx(player.dir)*2, player.y + 0.5 + vecy(player.dir)*2);
}
player.bombs --;
}
}
|
Much shorter version:
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
if (player.bombs <= 0) return;
setani("lay", "");
freezeplayer(0.2);
putBomb(1, player.x%64 + 0.5 + vecx(player.dir)*2, player.y%64 + 1 + vecy(player.dir)*2);
player.bombs --;
}
Good use of math reduces the need to use if checks.
And why did you have + 0 on the Y for the map and + 0 on the x and + 0.5 for the Y off a map?