Flash AS2 Hittest




  Tutorial Instructions



Follow the instructions above, here is the full source code below

Character Source:

onClipEvent(load){
	speed = 7;
	jspeed = 0;
	jumping = false;
	startY = this._y;
}
onClipEvent(enterFrame){
	if(jumping){
		this._y += jspeed;
		jspeed++;
		if(this._y > startY){
			this._y = startY;
			jumping=false;
		}
	}else if(Key.isDown(Key.SPACE)){
		jumping = true;
		jspeed=-20;
	}
	if(Key.isDown(Key.RIGHT)) this._x += speed;
	if(Key.isDown(Key.LEFT)) this._x -= speed;
}


Coin Source:
onClipEvent(enterFrame){
	if(this.hitTest(_root.guy)){
		_root.score += 1;
		this._x = -500;
	}
}


Main Source:
coin = 0;