Gameplay in HTML5: Homework #7
Input and Animation
Either in your FreeCellScreen.js or a separate module (FreeCellController.js?), set up handlers for input events. Consider these questions:
- What does the user intend when she clicks on a card?
- What should mouse movement do?
- Which module should know how to convert between mouse coordinates and elements of the game model?
- Do key events need to be handled for your game?
- Optional, but probably not so for mobile development: Should you handle touch events separately, and if so, how?
Modify your FreeCellView.js to display the motion and animation appropriate to the game. This should include:
- When the player picks up a card, show it in motion.
- If the player tries to put a card down where it is not permitted, what should you show?
Consider what to do at the end of a game.
- Create an animated effect if the the player wins.
- To test this, you might want to create a function in your model that fakes the end of a game, or a move or so before the end.
- After that, what?
- What if the player gets stuck and/or wants to start over? Provide a way to deal a new game, perhaps a button.
Consider the beginning of the game. How might you handle the dealing of the cards? (Feel free to keep this simple and quick.)
- Archive your files. E.g.:
tar -czvf Gameplay_7_MyName.tgz directory
(Please do not include jquery.js or modernizr.js files in the archive. Links are OK.)
E-mail the archive to the instructor.