I am having a problem with GameQuery (jQuery) collision detection
Tthey just never seem to fire?!? I have checked all the .arrow's exist and the same for the .bot's but it just never seems to call the function
I have the below code in my main callback:
$(".bot").each(function(){
$(this).collision(".arrow").each(function(){
alert("Test");
});
});
Do you have any idea why this would just simply be doing nothing? The bot walks (has it's x value) moved right over the arrow.
Many thanks,
Your problem is that the arrows are nested in a group. So you need to add the group to the collision detection:
$(this).collision(".arrow,.group").each(function(){
or
$(this).collision(".arrow,#arrows").each(function(){
Don't worry the groups are not returned by the collision() function. You just need to include them in the filter otherwise their children won't be checked for collision.