Thread: Bombs on Gmap
View Single Post
  #7  
Old 03-19-2012, 06:26 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 r3ckless View Post
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 == 0putbomb(1player.0.5 64player.64);
    if (
player.dir == 1putbomb(1player.1.5 64player.64);
    if (
player.dir == 2putbomb(1player.0.5 64player.2.5 64);
    if (
player.dir == 3putbomb(1player.2.5 64player.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
__________________
MEEP!
Reply With Quote