View Single Post
  #1  
Old 09-27-2001, 05:03 AM
freddyfox freddyfox is offline
Banned
freddyfox's Avatar
Join Date: Mar 2001
Posts: 6,705
freddyfox is on a distinguished road
Fluffy needs some fine tuning.

Quote:
// NPC made by Tgf_guy
// NPC improved by Tyne

//Basic Animal Template Version 0.1

timeout = .05;

if (created) {timeout = 0.05;timereverywhere;}
if (playerenters) {show;this.mode = 0;}
if (timeout)
{
//Moving
if (this.mode == 0)
{
if (this.dir == 0) {y=y-.5;}
if (this.dir == 1) {x=x-.5;}
if (this.dir == 2) {y=y+.5;}
if (this.dir == 3) {x=x+.5;}

// Animation
if (this.dir == 0)
{
if (this.frame == 0) setgif squirrel1.gif;
if (this.frame == 1) setgif squirrel2.gif;
}
if (this.dir == 1)
{
if (this.frame == 0) setgif squirrel7.gif;
if (this.frame == 1) setgif squirrel8.gif;
}
if (this.dir == 2)
{
if (this.frame == 0) setgif squirrel3.gif;
if (this.frame == 1) setgif squirrel4.gif;
}
if (this.dir == 3)
{
if (this.frame == 0) setgif squirrel5.gif;
if (this.frame == 1) setgif squirrel6.gif;
}
if (this.frame >1) {this.frame = 0;}

if (this.changedir > 50)
{
this.dir=int(random(0,4));
this.changedir = 0;
}
this.changedir ++;
this.frame ++;
} // End of mode checking
}

if(onwall(x + 0,y)) {this.dir=int(random(0,1));}
if(onwall(x -0,y)) {this.dir=int(random(1,4));}
if(onwall(x,y +2)) {this.dir=int(random(0,2));}
if(onwall(x,y -0)) {this.dir=int(random(2,4));}

if (was*hit) {hide;this.mode = 1;}
Tyne helped me with it, but the onwall is still a little rusty. The animal sometimes will go straight through a wall.

How can I fix it so that he doesn't?
Reply With Quote