SMASH!
Summary:Smash is a simple single page web game that aims to give the players some fun when they want to take a short break from work.
Details:The inspiration of Smash came from Flappy Bird and Google's T-rex game. The design of the game aimed to be as clean and simplistic as possible. The color theme of the game was chosen to be black and white, with red to indicate the health bars for the players. To emphasize the feeling of "game", both the art style and the typography of the page were chosen to be in pixel-fashion.
Like Flappy Bird that explored with the idea of simple and repetitive user controls, the control mechanic of Smash only requires the players to repetitively press down one key as fast as possible to attack the opponent. Smash allows two modes, either single player versus computer or two players where they versus each other. The players can choose their desired mode at the beginning of the game (either PVC or PVP). The players will then be promted to enter their desired usernames. If the players selected PVP mode, the game will start from there. If the player selected PVC mode, the game will then prompt the player to select his desired difficulty. The difficulty level ranges from 1- 100, which determines the speed at which the player gets attacked.
The game is centered around making attacks that will deduct the opponent's healt points. The meduction mechanism is done with the following code:

Since the valid attack is counted by how often the user triggers the "keyup" event, how fast the user presses and releases the dedicated key determines his chance of winning. In PVP mode, both player's rate of attack are determined by the method explained above. In PVC mode, the player's attack mechanism remains the same, the PC's attack rate is determined by the difficulty level that the player selected at the beginning of the game:

The difficulty level is used in the setInterval function, which determines how often the PC will attack the player: the higher the difficulty level, the shorter the time interval. If the player did not select a difficulty level at the beginning of the game, the game will set the difficulty to level 50 by default.