Clean
This commit is contained in:
parent
b977d52648
commit
ea64de94a6
1 changed files with 0 additions and 27 deletions
27
index.html
27
index.html
|
@ -76,7 +76,6 @@ var _COLOR_GRASS = '#388E3C',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// var i = 0
|
|
||||||
function animLoop() {
|
function animLoop() {
|
||||||
ctx.clearRect(0, 0, $('canvas').width(), $('canvas').height());
|
ctx.clearRect(0, 0, $('canvas').width(), $('canvas').height());
|
||||||
|
|
||||||
|
@ -130,12 +129,6 @@ var _COLOR_GRASS = '#388E3C',
|
||||||
ctx.fillStyle = _COLOR_BALL
|
ctx.fillStyle = _COLOR_BALL
|
||||||
ctx.fill()
|
ctx.fill()
|
||||||
ctx.closePath()
|
ctx.closePath()
|
||||||
//DEBUG
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.arc(x, y, 1, 0, Math.PI*2)
|
|
||||||
ctx.fillStyle = 'black'
|
|
||||||
ctx.fill()
|
|
||||||
ctx.closePath()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBracket() {
|
function drawBracket() {
|
||||||
|
@ -159,20 +152,6 @@ var _COLOR_GRASS = '#388E3C',
|
||||||
function collide() {
|
function collide() {
|
||||||
var coll = [false, false, false, false] //left, top, right, bottom
|
var coll = [false, false, false, false] //left, top, right, bottom
|
||||||
borders.forEach(function(el){
|
borders.forEach(function(el){
|
||||||
// if(bX >= el.x && bX <= el.x+el.width && bY >= el.y && bY <= el.y+el.height){
|
|
||||||
// drawDebugBorder(el)
|
|
||||||
// if(Math.round(bX) == el.x || Math.round(bX) == el.x+el.width){
|
|
||||||
// bVec = [-bVec[0], bVec[1]]
|
|
||||||
// }
|
|
||||||
// else if(Math.round(bY) == el.y || Math.round(bY) == el.y+el.height)
|
|
||||||
// bVec = [bVec[0], -bVec[1]]
|
|
||||||
// else {
|
|
||||||
// console.error('Error during collide()')
|
|
||||||
// console.log(el)
|
|
||||||
// console.log(Math.round(bY));
|
|
||||||
// console.log(Math.round(bX));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
var dx = (el.x+el.width/2)-(bX+bWidth/2)
|
var dx = (el.x+el.width/2)-(bX+bWidth/2)
|
||||||
var dy = (el.y+el.height/2)-(bY+bWidth/2)
|
var dy = (el.y+el.height/2)-(bY+bWidth/2)
|
||||||
var width = (el.width+bWidth)/2
|
var width = (el.width+bWidth)/2
|
||||||
|
@ -211,12 +190,6 @@ var _COLOR_GRASS = '#388E3C',
|
||||||
console.log('bottom > 0');
|
console.log('bottom > 0');
|
||||||
bVec = [bVec[0], -Math.abs(bVec[1])]
|
bVec = [bVec[0], -Math.abs(bVec[1])]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($.inArray(true, coll) > -1){
|
|
||||||
console.log(coll)
|
|
||||||
console.log(bVec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** CLASSES **/
|
/** CLASSES **/
|
||||||
|
|
Reference in a new issue