Quote:
Originally Posted by r3ckless
This is what I have, I just implemented what you gave me:
NPC Code:
//#CLIENTSIDE
function onWeaponFired()
{
if (player.dir=0){ putbomb(1, x+0.5 % 64, y-1 % 64); }
if (player.dir=1){ putbomb(1, x-1.5 % 64, y+1 % 64); }
if (player.dir=2){ putbomb(1, x+0.5 % 64, y+2.5 % 64); }
if (player.dir=3){ putbomb(1, x+2.5 % 64, y+1 % 64); }
player.bombs - 1;
}
|
IŽd do it like this (also what Mark explained)
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
if (player.bombs > 0) {
if (player.dir == 0) putbomb(1, player.x + 0.5 % 64, player.y - 1 % 64);
if (player.dir == 1) putbomb(1, player.x - 1.5 % 64, player.y + 1 % 64);
if (player.dir == 2) putbomb(1, player.x + 0.5 % 64, player.y + 2.5 % 64);
if (player.dir == 3) putbomb(1, player.x + 2.5 % 64, player.y + 1 % 64);
player.bombs -= 1;
}
}
but instead of having the check of every single direction of the player, IŽd suggest you to get familiar with vecx() and vecy(). Here is a great explanation made by Tigairius
http://forums.graalonline.com/forums...highlight=vecx