mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2024-12-22 06:15:29 +00:00
remove utility Point class and add ear pos gen
This commit is contained in:
parent
fc79fddac4
commit
71d578d5a6
1 changed files with 21 additions and 10 deletions
31
js/fox.js
31
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,
|
||||
|
|
Loading…
Reference in a new issue