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.
js
setinterval(function() { if (collisions($('.allships'), $('.bullet'))) { $(???).css('background-color','red'); score = + 50; $('#score').text(score); } }, 25);
Comments
Post a Comment