-
mc move towards another mc
hello,
i am having a problem with making an mc(fielder) move towards another mc(ball). The ball is always moving.
the problem is that the fielder gets the shakes all the time(he goes all shaky)
could anyone please help me.
-
ok let me give you some basic code okay on the following ball put this
onClipEvent(enterframe){
//if ball is farther right then move right
if (_root.ball._x > this._x){
this._x +=5
//if its not farther right but farther left then move left
}else if (_root.ball._x < this._x){
this._x -= 5
}
//if ball is farther down then move down
if (_root.ball._y > this._y){
this._y +=5
//if its not farther down but farther up then move up
}else if (_root.ball._y < this._y){
this._y -= 5
}
}
this will make it follow now if it does shake make sure that the ball and fielder x and y placement doesnt have a decimal and there speeds have a common denomenator like 2 and 4, 1 and 2, 3 and 6, and such and such
-
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|