Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 04-03-2009, 11:45 PM
Damix2 Damix2 is offline
RED SQUARE CLUB
Join Date: Nov 2003
Location: NY-what's better?
Posts: 3,577
Damix2 will become famous soon enough
Quote:
Originally Posted by fragman85 View Post
I just slipped throught it, but here some small tips:

Instead of:

if(blabla == 0) you can use if (!blabla)

Oh and also, instead of:

PHP Code:
      if (keydown(1)) { 
       
this.dir 1
      } 
      if (
keydown(2)) { 
       
this.dir 2
      } 
      if (
keydown(3)) { 
       
this.dir 3
      } 
      if (
keydown(0)) { 
       
this.dir 4
      } 
you can use:

PHP Code:
for (i=0i<4i++) {
  if (
keydown(i)) {
    
this.dir i;
  }

Ahh, thanks, I'll do that next time.

Quote:
Originally Posted by xXziroXx View Post
Instead of doing...

PHP Code:
this.on 1
this.on 0
... I'd suggest doing ...

PHP Code:
this.on true
this.on false
It just looks cleaner to me.
Guess that one is preference, I've always used 0 and 1s instead of booleans where I could. Though it is noted and I appreciate the reply.
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.