Impacts
For every object that is grav
or impact
you can make something happen when they impact.
To do this you need to add the <script type="text/javascript">
and </script>
as follows:
<script type="text/javascript">
function impact(object1, object2){
//things to happen here
}
</script>
When two elements hit each other the function impact
will be called with the two objects that hit each other.
Using parseInt(object1.innerHTML) function you can get the value of the number inside and.
On the right hand side of the screen uses the impact function to write to an empty div and giv us the objects that have collided with each other.