home *** CD-ROM | disk | FTP | other *** search
- class Control extends Object
- {
- var talking;
- var photoing;
- var stopping;
- var environment;
- var old_angle;
- var character;
- var opposites;
- var angle_speeds;
- var L;
- var R;
- var U;
- var D;
- var angle;
- function Control(p_env, p_character)
- {
- super();
- this.talking = false;
- this.photoing = false;
- p_env.setControl(this);
- this.stopping = false;
- this.environment = p_env;
- this.old_angle = 0;
- this.character = p_character;
- this.character.gotoAndStop(5);
- this.opposites = [null,5,null,7,null,1,null,3,null];
- this.angle_speeds = [null,{x:0,y:-11},{x:6,y:-9},{x:8,y:0},{x:6,y:9},{x:0,y:11},{x:-6,y:9},{x:-8,y:0},{x:-6,y:-9}];
- }
- function stopToTalk()
- {
- this.character.body.gotoAndStop(1);
- this.talking = true;
- this.environment.hit_center = _root.convo;
- }
- function stopTalking()
- {
- this.talking = false;
- }
- function stopToPhoto()
- {
- this.character.body.gotoAndStop(1);
- this.photoing = true;
- }
- function stopPhotoing()
- {
- this.photoing = false;
- }
- function use()
- {
- if(!this.talking && !this.photoing)
- {
- _root.splash._visible = false;
- this.L = Key.isDown(37) || Key.isDown(65);
- this.R = Key.isDown(39) || Key.isDown(68);
- this.U = Key.isDown(38) || Key.isDown(87);
- this.D = Key.isDown(40) || Key.isDown(83);
- this.angle = 0;
- var _loc3_ = 0;
- if(!this.L && !this.R && !this.U && this.D)
- {
- this.angle = 1;
- }
- else if(this.L && !this.R && !this.U && this.D)
- {
- this.angle = 2;
- }
- else if(this.L && !this.R && !this.U && !this.D)
- {
- this.angle = 3;
- }
- else if(this.L && !this.R && this.U && !this.D)
- {
- this.angle = 4;
- }
- else if(!this.L && !this.R && this.U && !this.D)
- {
- this.angle = 5;
- }
- else if(!this.L && this.R && this.U && !this.D)
- {
- this.angle = 6;
- }
- else if(!this.L && this.R && !this.U && !this.D)
- {
- this.angle = 7;
- }
- else if(!this.L && this.R && !this.U && this.D)
- {
- this.angle = 8;
- }
- else if(this.L && this.R && !this.U && !this.D)
- {
- _loc3_ = 1;
- }
- else if(!this.L && !this.R && this.U && this.D)
- {
- _loc3_ = 2;
- }
- if(this.angle == 0)
- {
- if(this.old_angle > 0)
- {
- this.character.gotoAndStop(this.old_angle);
- this.character.body.gotoAndStop(5);
- if(!this.stopping)
- {
- this.stopping = true;
- }
- else
- {
- this.stopping = false;
- }
- this.environment.moveBy(this.angle_speeds[this.old_angle].x / 2,this.angle_speeds[this.old_angle].y / 2);
- }
- else
- {
- this.stopping = false;
- this.character.body.gotoAndStop(1);
- }
- }
- else if(_loc3_ == 0)
- {
- this.stopping = false;
- if(this.opposites[this.angle] == this.old_angle)
- {
- this.character.gotoAndStop(this.angle + 9);
- this.environment.moveBy(this.angle_speeds[this.old_angle].x / 2,this.angle_speeds[this.old_angle].y / 2);
- }
- else if(this.old_angle == 0)
- {
- this.character.gotoAndStop(this.angle);
- this.character.body.gotoAndPlay(3);
- this.environment.moveBy(this.angle_speeds[this.angle].x / 2,this.angle_speeds[this.angle].y / 2);
- }
- else
- {
- this.character.gotoAndStop(this.angle);
- this.character.body.gotoAndStop(4);
- this.environment.moveBy(this.angle_speeds[this.angle].x,this.angle_speeds[this.angle].y);
- }
- }
- else if(_loc3_ == 1 && this.old_angle == 3)
- {
- this.character.gotoAndStop(16);
- this.environment.moveBy(this.angle_speeds[this.old_angle].x / 2,this.angle_speeds[this.old_angle].y / 2);
- }
- else if(_loc3_ == 1 && this.old_angle == 7)
- {
- this.character.gotoAndStop(12);
- this.environment.moveBy(this.angle_speeds[this.old_angle].x / 2,this.angle_speeds[this.old_angle].y / 2);
- }
- else if(_loc3_ == 2 && this.old_angle == 1)
- {
- this.character.gotoAndStop(14);
- this.environment.moveBy(this.angle_speeds[this.old_angle].x / 2,this.angle_speeds[this.old_angle].y / 2);
- }
- else if(_loc3_ == 2 && this.old_angle == 5)
- {
- this.character.gotoAndStop(10);
- this.environment.moveBy(this.angle_speeds[this.old_angle].x / 2,this.angle_speeds[this.old_angle].y / 2);
- }
- if(!this.stopping)
- {
- this.old_angle = this.angle;
- }
- this.character.swapDepths(this.environment.pos_y);
- }
- }
- }
-