top | item 21594436

Show HN: Virtual pet game made for my daughter

256 points| ben85ts | 6 years ago |bsawyer.github.io | reply

67 comments

order
[+] RugnirViking|6 years ago|reply
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.

The animations and the aestetic are great though!

[+] AllanHoustonSt|6 years ago|reply
I thought clicking around different combinations of buttons to discover what would happen was part of the fun. I kept trying to kill it to no avail.
[+] clarkey252|6 years ago|reply
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).

[+] jboy55|6 years ago|reply
just put debug=1 into the location bar.
[+] nkrisc|6 years ago|reply
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;
    }
  }
[+] orisa2|6 years ago|reply
From the post, I wasn't sure if you knew, but JS also has regular default parameters if that's all you want.
[+] chiyc|6 years ago|reply
I think I would call it nested destructuring with default values.
[+] minhajuddin|6 years ago|reply
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/
[+] ben85ts|6 years ago|reply
That’s a really good idea!
[+] JDiculous|6 years ago|reply
Looks amazing! How did you make the SVG/animations?

I'm just a developer, but seeing stuff like this really makes me want to learn design.

[+] volkk|6 years ago|reply
following up as another developer that really wants to get better at overall drawing/design. what are the best resources?
[+] ben85ts|6 years ago|reply
Just separating different css transform animations across nested divs
[+] tofu_ink|6 years ago|reply
console javascript hacking ;)

var ele = document.createElement('div'); ele.setAttribute('id', 'foo'); //$('.stage').append("<div id='foo'>m</div>"); document.getElementsByClassName('stage')[0].appendChild(ele);

var dict = { pain: { energy: 'paddle', waste: 'needs to fart' }, sad: { ideas: 'coffee' }, frustration: { fatigue: 'sleep', energy: 'food' // 'paddle' }, restless: { concentration: 'knit?', waste: 'fart' }, tired: { fatigue: 'needs sleep' } };

// happy concentration // estatic ideas / waste // restless waster

trigger = setInterval(function() { var s = getState(STATE); var msg = s.mood.name + ' ' + s.mood.reason ; if (dict[s.mood.name] && dict[s.mood.name][s.mood.reason]) msg = dict[s.mood.name][s.mood.reason]; var other = ['concentration','energy','fatigue','ideas','waste']; for (var i = 0; i < other.length; ++i) msg += ' ' + other[i] + ':' + (s.creature[other[i]].count).toFixed(1);

    document.getElementById('foo').innerHTML = '<small>'+ msg +'</small>';
}, 100)

/* i couldnt find the mute button */ function playSound(state, sound){}

[+] dynamite-ready|6 years ago|reply
Great artstyle. You should make it a fully fledged PWA. I would have downloaded it in a heartbeat.
[+] throwaway35784|6 years ago|reply
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?
[+] ben85ts|6 years ago|reply
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.
[+] beaconstudios|6 years ago|reply
not the author, but it looks Java-like to me - with the "everything is an object/class" approach.
[+] rmetzler|6 years ago|reply
I try to find the time to write a small game for my daughter for so long! I'm jealous. Good job!
[+] ben85ts|6 years ago|reply
Thank you! It is definitely hard to find time. Certainly helped that she wanted to “help”(she’s 6) write it with me sometimes :)
[+] workthrowaway|6 years ago|reply
great job! only a couple of seconds with the game and i felt calmed down somehow lol we need more slow paced, calming things like this
[+] trianglem|6 years ago|reply
Try playing death stranding. It’s very calming making “deliveries” while enjoying the great graphics and music.
[+] Fnoord|6 years ago|reply
I've been playing Pwnagotchi with my daughter. (Not really, cause she's still too young.) Thanks for the inspiration though.
[+] Aeolun|6 years ago|reply
Ah, my heart. It was sad for such a long time and I just didn’t know what it wanted.

Reminds me of my son until he was 1 year old(ish).

[+] mobilemidget|6 years ago|reply
great :) add more stuff, I cant teach my daughter things can live on coffee and cookies... just kidding of course we can :)
[+] natex|6 years ago|reply
Can you add a brown face choice? Right now the choices are peach (caucasian) or alien.
[+] htk|6 years ago|reply
Caucasian? It’s an imaginary pet, not a person.
[+] ben85ts|6 years ago|reply
Sure, thanks for the suggestion!
[+] ravenstine|6 years ago|reply
Very cute! Maybe someday this will inspire her to learn how to code. :)
[+] shakna|6 years ago|reply
I'd rename it. Tamagotchi is still a trademarked name, and someone still owns it and produces toys with the name.

Ignoring that, it seems a fun little thing. I have trouble understanding the faces, but I assume that just takes practice.

It's pretty neat, fast, with the all-important cute animations that trick you into caring about a state machine.

[+] ben85ts|6 years ago|reply
You’re absolutely right, would love any suggestions!
[+] fredley|6 years ago|reply
Hakanuchi