Thread: Snake
View Single Post
  #3  
Old 04-03-2009, 08:59 PM
fragman85 fragman85 is offline
Banned
Join Date: Mar 2009
Location: Switzerland
Posts: 261
fragman85 is on a distinguished road
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;
  }

Reply With Quote