-- I'm working on a game which player have to evade the thrown stuffs. The input is webcam which captured the player into the game and process to display via the screen as a silhouette.
I'm working on the hitTest method between the BitmapData (the player's silhouette) and the thrown stuffs (the newly created movie clip: which is moved by flash's Tween class)
-- I googled and found that there are different parameters to put between the hitTest method of Movie Clip and the hitTest method of BitmapData
I got stuck, confusing and completely no idea to solve! lol
-- I made a text box to inspect this hitTest, and the results seems to be always "HIT" (between the player's silhouette and the thrown stuff)
I think this maybe the transparency issue, but I've tried every ways I know.
Please make a look at the captured image and you'll get the idea.
Here's the code of the hitTest
Actionscript Code:
onEnterFrame = function(){
for(j=0;j<13;j++){
// _global.bitmap is the player's silhouette // and this["stuffBitmap"+j] is the newly created stuff which is being thrown by Flash's Tween class
if(_global.theBitmap.hitTest(pt, 0xff, this["stuffBitmap"+j] )){ // hit amihit.text = "hit"; }else{ // not hit amihit.text = "not hit"; } }
And here's some code that immediately convert the latest created movie clip to a BitmapData, which is needed to do hitTest
Actionscript Code:
// create the stuff _root.createEmptyMovieClip("stuff"+i, newdepth); _root["stuff"+i].attachMovie("stuff1", "stuffmc"+i, newdepth+1);
// create bitmap data to draw the stuff _parent.gameRound1["stuffBitmap"+i] = new BitmapData(640, 480, true, 0xff); _parent.gameRound1["stuffBitmap"+i].draw(_root["stuff"+i]);
Sorry if lack of essential information in the post.
- The file was named PipeMotion.fla
- The hitTest function is in the movie clip Round 1
- The processing of the player's input to silhouette is in the _root