I need urgent help, Im close to releasing my app and my friend added the collision in the beggining if this looks familiar PLEASE IM really desperate right now this game is my pride.
function collides(a, b) {
var aTop = a.offset().top;
var aLeft = a.offset().left;
var bTop = b.offset().top;
var bLeft = b.offset().left;
return !(
((aTop + a.height()) < (bTop)) ||
(aTop > (bTop + b.height())) ||
((aLeft + a.width()) < bLeft) ||
(aLeft > (bLeft + b.width()))
);
}
//colliding stuff and responce.
function handleCollisions() {
if (collides($('#firstObs'),$('#player'))) {
$('#levelOne').stop();
$('#player').css('border', 'solid 1px red');
}
else { // if not collision
$('#player').html("<p></p>");
}
}
This is serious please do not give me grief right now.
Is there a link that he might of got this code off of to prove he did write it him self
Aucun commentaire:
Enregistrer un commentaire