Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too Slow! #11

Open
5 tasks
jugglinmike opened this issue Sep 25, 2014 · 0 comments
Open
5 tasks

Too Slow! #11

jugglinmike opened this issue Sep 25, 2014 · 0 comments
Milestone

Comments

@jugglinmike
Copy link
Collaborator

This is starting to feel like a game, but we're kind of shooting fish in a
barrel. To make the interaction feel a little more urgent, the directory should
hide the mole if it hasn't been whac'd after a while.

There are some really direct ways to do this that don't require a lot of code,
but let's do it right!

  • mole.js
    • Define no-op methods on the Mole prototype for onHide and onShow
    • Invoke this.onHide from within the hide method
    • Invoke this.onShow from within the show method
    • Define an isHidden method on the Mole prototype that returns true
      if the Mole is currently hidden and false otherwise
  • director.js
    • Define a onShow method for each mole that hides the mole after a
      random delay. (Refer back to scheduleShow for a reminder of how to do
      this.) Only hide the mole if it is visible (use the new isHidden method
      to check).

When this is done, you'll notice that the moles only re-appear if you whac
them--if they hide themselves, then never come back up again. This is because
we're calling scheduleShow only in onWhack. Really, we want to schedule a
new showing whenever the mole hides (whether because it has been whac'd or
because it hid itself). Fix this bug!

@jugglinmike jugglinmike modified the milestone: The Director Sep 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant