From 71d578d5a63cd05ebc8f781237811abb9f9c065d Mon Sep 17 00:00:00 2001 From: Jeffrey Sun Date: Thu, 15 Dec 2016 12:21:43 -0800 Subject: [PATCH] remove utility Point class and add ear pos gen --- js/fox.js | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/js/fox.js b/js/fox.js index c3a70b2..1d28872 100644 --- a/js/fox.js +++ b/js/fox.js @@ -4,12 +4,9 @@ var IMG_WIDTH = 64; var IMG_HEIGHT = 64; // move to helper function -var Point = function (x, y) { - return { - x: x, - y: y - }; -}; +var genBetween = function (min, max) { + return min + (max - min) * gen(); +} var randomFox = (function () { @@ -20,18 +17,32 @@ var randomFox = (function () { var height = IMG_HEIGHT / 2; var ears = (function () { - // TODO: generate stuff + var offsetX = genBetween(0, width/2); return { left: { - x: null + x: origin.x + (width/2) - offsetX, + y: origin.y }, right: { - x: null + x: origin.x + (width/2) + offsetX, + y: origin.y } }; - }); + }()); + + var eyes = (function () { + // TODO: generate stuff + return { + + }; + }()); return { + shape: { + origin: origin, + width: width, + height: height + }, ears: ears, eyes: eyes, nose: nose,