Thread: shorter way?
View Single Post
  #4  
Old 08-14-2007, 04:31 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
for(temp.i = 0; i < 4; i ++) {
  if (
player.dir == i) {
    
temp.tx = int(this.x + (i==1?-1:(i==3?1:0));
    
temp.ty = int(this.y + (i==0?-1:(i==2?1:0));
    if (
tiletype(tx, ty) != 22) {
      goto(
tx, ty);
    }
  }
} 
PHP Code:
temp.a = {
  { 
0,-1},
  {-
1, 0},
  { 
0, 1},
  { 
1, 0}
};
temp.b = player.dir;
if (
tiletype(int(this.x + a[b][0], this.y + a[b][1])) != 22) {
  goto(
int(this.x + a[b][0], this.y + a[b][1]);
} 
dunno if they work (no vecx/y used ;o)
__________________
Reply With Quote