Permalink
Browse files

Debug show colliders in white when for a time after colliding.

  • Loading branch information...
kevadsett committed Sep 10, 2016
1 parent 8dc0132 commit 7f46163bbaac55e71ebdb9229db1dcdef0194bee
Showing with 6 additions and 1 deletion.
  1. +1 −0 src/js/StaticHandlers/CollisionHandler.js
  2. +5 −1 src/js/views/LineColliderView.js
@@ -36,6 +36,7 @@ var CollisionHandler = {
var intersectionCheckResult = currentCollidee.checkIntersection(pointA, pointB);
if (intersectionCheckResult) {
currentCollidee.model.lastCollisionTime = Date.now();
collisions.push({
collidee: currentCollidee,
intersectionResult: intersectionCheckResult
@@ -7,7 +7,11 @@ LineColliderView.prototype = {
draw: function(layer) {
if (layer !== "debug") return;
if (window.drawDebug) {
ctx.strokeStyle = "red";
if (Date.now() - this.model.lastCollisionTime < 100) {
ctx.strokeStyle = "white";
} else {
ctx.strokeStyle = "red";
}
var scaledA = this.model.a.scale(window.gameScale);
var scaledB = this.model.b.scale(window.gameScale);

0 comments on commit 7f46163

Please sign in to comment.