PDA

View Full Version : help with golf game



sandrinik
February 19th, 2005, 05:31 AM
hi, i'm new of this chat.
Sorry for my english.
i have a problem with my golf game. i don't know how bounce a ball.
The code of ball is:




onClipEvent(load){}
onClipEvent(enterFrame){
if (_root.speed>0) {
_x +=Math.sin(_root.angle*(Math.PI/180))*_root.speed;
_y -=Math.cos(_root.angle*(Math.PI/180))*_root.speed;
_root.speed--;
if(this.hitTest(_parent._root.muro)){ //bounce with other movieclip
trace("coll");
_x -= Math.sin(_root.angle*(Math.PI/180))*_root.speed;
_y += Math.sin(_root.angle*(Math.PI/180))*_root.speed;
}
if(_y<100){ //height of stage
trace("100");
_x -= Math.sin(_root.angle*(Math.PI/180))*_root.speed;
_y += Math.sin(_root.angle*(Math.PI/180))*_root.speed;
}
}
}




thank you very much