View Single Post
  #6  
Old 06-06-2003, 09:29 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by DarkShadows_Legend
It doesn't seem to work for me.
|| is a boolean thing, so it only returns true or false.
'var == (1||3)' would check wether var is true, as '(1||3)' returns true because neither 1 or 3 is false.
Not sure wether it is exactly like that in GScript, but in theory it should be like that.

Probably one could also save some lines
by using vecx/y.
NPC Code:
if (playerdir == 0) playery --;
else if (playerdir == 1) playerx --;
else if (playerdir == 2) playery ++;
else if (playerdir == 3) playerx ++;

is inferior to
NPC Code:
playerx += vecx(playerdir);
playery += vecy(playerdir);

Reply With Quote