HTML and CSS Reference
In-Depth Information
newParticle.x = x;
newParticle.y = y;
//ConsoleLog.log("newParticle.life=" + newParticle.life);
particles.push(newParticle);
}
}
function boundingBoxCollide(object1, object2) {
var left1 = object1.x;
var left2 = object2.x;
var right1 = object1.x + object1.width;
var right2 = object2.x + object2.width;
var top1 = object1.y;
var top2 = object2.y;
var bottom1 = object1.y + object1.height;
var bottom2 = object2.y + object2.height;
if (bottom1 < top2) return(false);
if (top1 > bottom2) return(false);
if (right1 < left2) return(false);
if (left1 > right2) return(false);
return(true);
};
function splitRock(scale,x,y){
for (var newRockctr=0;newRockctr<2;newRockctr++){
var newRock = {};
//ConsoleLog.log("split rock");
if (scale==2){
newRock.scoreValue = medRockScore;
newRock.width = 25;
newRock.height = 25;
newRock.halfWidth = 12.5;
newRock.halfHeight = 12.5;
}else {
newRock.scoreValue = smlRockScore;
newRock.width = 16;
newRock.height = 16;
newRock.halfWidth = 8;
newRock.halfHeight = 8;
}
newRock.scale = scale;
newRock.x = x;
newRock.y = y;
newRock.dx = Math.random()*3;
if (Math.random()<.5){
newRock.dx*=-1;
Search WWH ::




Custom Search