javascript - How to reference "this" argument in a called function -


i've coded simple game gun, when clicked, shoots bullet hit moving target (or 'ship' referred in class names) of there 3 classes of targets varying speeds, time intervals , locations. have collision function set detect when bullet makes contact of targets. can't figure out how to apply collision consequence (turn 'this' ship red, score 50 points, etc.) specific target bullet collided with.

http://jsbin.com/cujuxuha/7/

js

setinterval(function() {     if (collisions($('.allships'), $('.bullet'))) {         $(???).css('background-color','red');         score = + 50;         $('#score').text(score);     } }, 25); 


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -