diff --git a/index.html b/index.html
index 3d0dc62..324a291 100644
--- a/index.html
+++ b/index.html
@@ -29,9 +29,9 @@ var _COLOR_GRASS = '#388E3C',
_COLOR_HOLE = '#000000',
_COLOR_BRACKET = '#000000'
-
+
var _MAX_BRACKET = 100,
- _BALL_SPEED = 50,
+ _BALL_SPEED = 100,
_BALL_SPEED_THRESHOLD = 10
$(function(){
@@ -44,13 +44,13 @@ var _COLOR_GRASS = '#388E3C',
drawBorder(23+5, 500+10-5, 500-10, 5)
drawBorder(500+23-5, 10+5, 5, 500-10)
drawHole(432, 366)
- setInterval(animLoop, 10)
+ setInterval(animLoop, 5)
$(document).mousemove(function(e){
pX = e.pageX - $('canvas').offset().left
pY = e.pageY - $('canvas').offset().top
})
-
+
$(document).mousedown(function(e){
var strength = Math.hypot(pX - bX, pY - bY)
if(strength > _MAX_BRACKET)
@@ -79,7 +79,7 @@ var _COLOR_GRASS = '#388E3C',
// var i = 0
function animLoop() {
ctx.clearRect(0, 0, $('canvas').width(), $('canvas').height());
-
+
if(bVec != null){
collide()
drawBall(bX = bX-bVec[0], bY = bY-bVec[1])
@@ -110,7 +110,7 @@ var _COLOR_GRASS = '#388E3C',
staticctx.fillStyle = 'red'
staticctx.fillRect(border.x, border.y, border.width, border.height)
}
-
+
function drawDebugBorderUndo(border) {
staticctx.fillStyle = _COLOR_BORDER
staticctx.fillRect(border.x, border.y, border.width, border.height)
@@ -141,7 +141,7 @@ var _COLOR_GRASS = '#388E3C',
x = bX+_MAX_BRACKET*Math.cos(angle)
y = bY+_MAX_BRACKET*Math.sin(angle)
}
-
+
ctx.beginPath()
ctx.moveTo(bX, bY)
ctx.lineTo(x, y)
@@ -200,18 +200,18 @@ var _COLOR_GRASS = '#388E3C',
}
if(coll[1]){
console.log('top < 0');
- bVec = [bVec[0], Math.abs(bVec[1])]
+ bVec = [bVec[0], Math.abs(bVec[1])]
}
if(coll[2]){
console.log('right > 0');
- bVec = [-Math.abs(bVec[0]), bVec[1]]
+ bVec = [-Math.abs(bVec[0]), bVec[1]]
}
if(coll[3]){
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(bVec);
}