View Single Post
  #2  
Old 10-24-2011, 04:32 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
This is something from a project Dusty made once.

PHP Code:
function onCreated() {
  
showcharacter();
  
this.dir = (int(random(0,2))*2)+1;
  
this.attr[1] = "ce_chicken-white.png";
  
setCharani("ce_chicken_idle",null);
  
setTimer(random(.25,2));
}

function 
onTimeout() {
  
temp.dx random(-3,3);
  
temp.dy random(-3,3);
  
temp.dist = (dx^2+dy^2)^.5;
  
temp.checkwall 0;
  for (
temp.i=0;i<dist;i+=.5) {
    
//if (onwall2(this.x+.5+((dx/dist)*.5)+(dx*i),this.y+1+((dy/dist)*.5)+(dy*i),2,2)) {
    
if (onwall2(this.x+1+(dx/dist)+(dx*i),this.y+1+(dy/dist)+(dy*i),1,1) || onwater(this.x+1.5+(dx/dist)+(dx*i),this.y+1.5+(dy/dist)+(dy*i))) {
      
checkwall 1;
      break;
    }
  }
  if (
checkwall == 1) {
    
setTimer(.1);
    return;
  }

  
setCharani("ce_chicken_walk",null);
  if (
dx 0this.dir 3;
  else 
this.dir 1;
  
move(dx,dy,dist/3,8);
}


function 
onMovementfinished() {
  
setCharani("ce_chicken_idle",null);
  
setTimer(random(.1,2));


Semms like there is no parameter for that. Just using onwall2().
__________________
MEEP!
Reply With Quote