Remake of the classic arcade game that involves maneuvering a 'light cycle' in an arena against an opponent. Tron was built using Javascript, jQuery, HTML, and CSS. Game can be played against a computer or with two players.
-
Object-oriented - classes are made for
bike
,board
,coord
, andview
. -
The
view
renders the board and listens for key events in the browser. The board grid is constructed usingul
andli
tags. Each time the board is rendered, the CSS class selector of eachli
item is updated using jQuery to reflect the position of the bikes. -
The
board
class takes dimensions as arguments and checks if coordinates are within its boundaries. -
The
bike
holds the logic for turns, collisions, and the AI of the computer player.
-
Collision detection
-
Two-player option
-
Simple AI that makes turning decisions based on the number of available steps in each direction. The computer is programmed to make an occasional random turn to avoid 'wall-hugging'.
-
User can change difficulty of the computer player. The easiest computer makes lots of random moves which makes it likely to crash. The hardest computer makes no random moves.
-
Improve AI by using a more advanced algorithm that is based on searching areas (instead of linear paths). Maybe something similar to Flood Fill
-
Add websocket for multi-player games over server