Personally, I think a little more feedback into what effect each action has would be good. I couldn't figure out if the buttons did anything at all except change the animation. Perhaps a status bar showing the hunger/thirst/boredom going up or whatever.
I think that this is supposed to be similar to the classic tamagotchi's off of the 90's. There were no status bars (like a real pet) and figuring it out was part of the charm . I do think that if the pet is really hungry/thirsty/tired there should be an a different animation, like pointing to mouth for hunger.
I agree animations and aesthetic are awesome (much better than the original LCD pixel Tamagotchi's).
I've never seen this pattern before in JS, in the parameters for the constructor. playing with it in the browser, I can see it lets you define default values for expected arguments when calling it but you can provide other values.
What is this called? I'd like to read more about it.
class Resource{
constructor({
min = 0,
max = 1,
count = 0
}={}){
this.min = min;
this.max = max;
this.count = count;
}
}
Not as nice though, as the arguments still depend on the order. Passing a object gives the benefit of named arguments AND position of the arguments no longer matter (as object keys don't have order and also, it's a object with key/values)
Yeah, the trick is basically many things chained together. First is to pass a object to a function instead of position-locked arguments. Second is to default to a empty object. Third is to destruct the object in the function parameter directly. Fourth to supply default destruct values. Fifth is to set the values in the current instance of that class.
Love the game! It would be nice to wrap this up in an Android app and put it on the market place just because when I build games like these my kids end up closing the browser somehow :) I built a few of these at: http://putty.minhajuddin.com/
var ele = document.createElement('div');
ele.setAttribute('id', 'foo');
//$('.stage').append("<div id='foo'>m</div>");
document.getElementsByClassName('stage')[0].appendChild(ele);
I like the style of the code. Can talk about your inspiration for it? I haven't seen Javascript written in that way before. It's clean but, at least to me, unintuitive. What is your background?
Been a frontend dev for 10 years angular and react. You’re right it’s a little mix of functional state management and imperative structures for the game objects.
Just noticed I'm being downvoted for this? hahaha This wasn't even a Trump reference, just an alliteration... PTSD much? I'm on the other side of the world
Actually it does, because the author of the post literally asked for name suggestions. So indeed your comment doesn't add anything substantial to the discussion.
The animations and the aestetic are great though!