00:00
00:00
Newgrounds Background Image Theme

Okidou just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Simple question Help.

569 Views | 10 Replies
New Topic Respond to this Topic

Simple question Help. 2006-08-05 12:08:40


Ok I am making a RPG and for some reason this code isnt working, What is suppose to happen is the enemy chases the main character and it mostly works. But for some reason he wont go left. I really dont know why it isn working because I have done this before with no problems. There are no syntax errors.

Here is the code.

function search_kill() {
if(this.x>_root.man._x){
this._x -= speed;
this.gotoAndStop(4);
}else if(this._x<_root.man._x){
this._x += speed;
this.gotoAndStop(3);
}else if (_root.man._y<this._y) {
this.walk = true;
this.gotoAndStop(2);
this._y -= speed;
}else if (_root.man._y>this._y) {
this.walk = true;
this.gotoAndStop(1);
this._y += speed;
}
if (this.hitTest(_root.man) && this.attack == 1) {
this.walk = false;
this.guard.gotoAndStop(2);
this.speed = 0;
} else {
this.attack = random(2)+1;
this.guard.gotoAndStop(1);
this.speed = 8;
}
}

Also I would like to add something so he will avoid walking threw walls.

Response to Simple question Help. 2006-08-05 12:27:50


Cmon someone!

Response to Simple question Help. 2006-08-05 12:38:52


Yep, But he doesnt go left?

Response to Simple question Help. 2006-08-05 12:39:16


Have you tried doing just 'if' instead of 'else if'

Response to Simple question Help. 2006-08-05 12:51:19


Yeah, it still doesnt work. And the animation when he runs right doesnt work either when I do that.

Response to Simple question Help. 2006-08-05 13:27:06


Can anyone help me out. It shouldnt be to hard to fix...

Response to Simple question Help. 2006-08-05 14:00:07


BUMP!!!

Response to Simple question Help. 2006-08-05 16:20:45


Someone help me out?

Response to Simple question Help. 2006-08-05 17:31:48


i have a question. how do you guys know all these codes!


Blok' Party, Orbital Khaos, site, MSMstudios, Phrozen Phlame

BBS Signature

Response to Simple question Help. 2006-08-05 17:37:13


by studying... and practice...


OS: Ace, coming soon to Newgrounds. Keep an eye out for it.

BBS Signature

Response to Simple question Help. 2006-08-05 17:37:18


becasue they have learnt them.