Cypher1 / 13k_lost

A tiny game (hopefully)
3 stars 1 forks source link

Fixed bug where player could spawn inside a wall, added Array.range #8

Closed Cypher1 closed 7 years ago

Cypher1 commented 7 years ago

Ahh, worked out how to do it with generators. One sec

Cypher1 commented 7 years ago

Yup. ~86%

On Sun., 10 Sep. 2017, 6:19 pm Wemyss notifications@github.com wrote:

@wemyss commented on this pull request.

In public/client/globals.js https://github.com/Cypher1/13k_lost/pull/8#discussion_r137943385:

@@ -14,6 +14,24 @@ Number.prototype.clamp = function(min, max) { return Math.min(Math.max(this, min), max); };

+/**

    • Returns an array of numbers in a given range (like python range)
  • *
    • Example: range(0, 3) gives a generator over [0, 1, 2]
  • *
    • @param {Number} s The start value
    • @param {Number} e The end value
    • @param {Number} step The value to increment by (default is 1)
    • @returns {Generator of Number} An generator of numbers in the range [min, max) increasing by step
  • / +function range(s, e, step=1) {
  • var i=s;
  • while(i<e) {
  • yield i;

caniuse.com - do many browsers support this :P

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Cypher1/13k_lost/pull/8#pullrequestreview-61678868, or mute the thread https://github.com/notifications/unsubscribe-auth/ABEaHlAo-f0pSKZJjQaaPWQej2fPZym5ks5sg5uWgaJpZM4PSOOX .