Your Ad Here

Sunday, October 28, 2007

HitTest problem

i ve tired 2 different codes just making my rock go left to the right either way right to the left when it hit the blackL _mc or blackR_mc bar but doesnt work is there something wrong with my code?PLEASE HELP

1,

var MOVE_LEFT:Number = -5;
var MOVE_RIGHT:Number = 5;
var current_direction:Number = MOVE_LEFT;

function moveRock():Void {
this.rock_mc._x = this.rock_mc._x+current_direction;
if (this.rock_mc_.x<0) {
current_direction = MOVE_RIGHT;
rock_mc.gotoAndStop("right");
} else if (this.rock_mc._x>550) {
current_direction = MOVE_LEFT;
rock_mc.gotoAndStop("left");
}
}

2.This one when hit the movie clip it will turn to the right but not what i want to be , i want hit the bar.

function moveRock():Void {
this.rock_mc._x = this.rock_mc._x-10;
//for(i:Number=0;i<495;i+)
if (this.rock_mc.hitTest(_root.blackL_mc)) {
this.rock_mc._x = 500;

}
}

Topic Replies: 0

Read More...

[Source: Ozzu - Posted by FreeAutoBlogger]
Your Ad Here

No comments: