Skip to content

Commit

Permalink
Added custom definition for Math.trunc to accomodate older browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
marler8997 committed Oct 25, 2015
1 parent af6db41 commit 215c15b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SlimeAI.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Make sure Math.trunc is defined (for older browsers)
Math.trunc = Math.trunc || function(x) {
return x < 0 ? Math.ceil(x) : Math.floor(x);
}

// Assumes gravity is -1 per frame
function countFramesTillBelow(y, vy, limit) {
Expand Down

0 comments on commit 215c15b

Please sign in to comment.