Hello,
I am creating a game where a shopper moves horizontally in a store and runs into different items. When the shopper "hits’ an item, he/she displays a speech bubble identifying the item (produce, milk, shopping bag, etc…). I realize that I need to utilize a multiple hittest between the shopper (shopper_mc) and the many items in the store (shopping_bag_mc, produce_mc, milk_mc, etc…).
Here is my current code which resides in a movie clip called background_mc and it does not work:
function hit(){
if (_root.shopper_mc.keyFlag==false){
////////////////item1///////////////////
if (_root.shopper_mc.hitTest(info_desk_mc)){
_root.shopper_mc.attachMovie(“speech_info_desk_mc”, “instance1”, 1, {_x:-28, _y:-235});
_root.text = “Info Desk Detected”;
}
////////////////item2///////////////////
if (_root.shopper_mc.hitTest(shopping_bag_mc)){
//_root.shopper_mc.attachMovie(“speech_shopping_bag_mc”, “instance1”, 1, {_x:-28, _y:-235});
_root.text = “Shopping Bag Detected”;
}
////////////////item3///////////////////
if (_root.shopper_mc.hitTest(radio_mc)){
//_root.shopper_mc.attachMovie(“speech_radio_mc”, “instance1”, 1, {_x:-28, _y:-235});
_root.text = “Radio Detected”;
}
} else {
_root.shopper_mc.createEmptyMovieClip(“empty_mc”, 1);
_root.text = “No Item Detected”;
}
}
setInterval(hit,4);
Thanks ahead of time for any help