home *** CD-ROM | disk | FTP | other *** search
- function walk()
- {
- gotoAndStop("stand");
- play();
- }
- function beginwalkaction()
- {
- this.direction = Math.random() <= 0.5 ? -1 : 1;
- this.onEnterFrame = walkaction;
- gotoAndPlay(this.direction != -1 ? "r" : "l");
- }
- function walkaction()
- {
- if(Math.random() > 0.99)
- {
- this.direction = -1 * this.direction;
- gotoAndPlay(this.direction != -1 ? "r" : "l");
- return undefined;
- }
- if(Math.random() > 0.98)
- {
- this.power();
- return undefined;
- }
- _X = _X + 1 * this.direction;
- wrap();
- }
- function sit()
- {
- this.onEnterFrame = undefined;
- gotoAndStop("sit");
- play();
- }
- function wrap()
- {
- if(direction == 1 && _X > 800)
- {
- _X = -20;
- }
- else if(direction == -1 && _X < -20)
- {
- _X = 800;
- }
- }
-