Actionscript 3 calling a Movieclip inside another Movieclip -
i working on cricket game, stuck here little problem. have programmed game registers when ball hits guy, , happen. striker(mcguy1) contains bat(mcbat) movieclip want call. want ball when hits bat movieclip , not whole guy. code that:
// function hitting bat function hitbat(event:event):void { if(mcball.hittestobject(mcguy1)){ score++ mcball2.gotoandplay(2); mcball.gotoandstop(1); txtbox2.text = "you hit ball!"; myshot2.play(); txtbox3.text = "score: " + score; } else if(mcball.hittestobject(mcwall)) { txtbox2.text = "you missed!"; } }
so instead of hittestobject mcguy1, want hitting mcbat movieclip.
thanks in advance!
you should able do
if(mcball.hittestobject(mcguy1.mcbat))
instead of if(mcball.hittestobject(mcguy1))
mcbat
member of mcguy1
if child.
Comments
Post a Comment