I am using some collision code I found on stack overflow, it uses .setInterval which when lowered to something like in a game doesn't seem very efficient. I wish to reset #div1 upon a false result.
Would an EventListener be preferable? What would be the best alternative for something with collisions possibly happening every second?
window.setInterval(function() {
var bang = collision(collisionOne, collisionTwo);
$('#result').text(bang);
if (bang) === false){
$('#div1').detach();
}
}, 20);