This project was developed for the LI1 University of Minho Subject of the Software Engineering degree. This was our first project developed in the university and we were very impressed with the result.
demo.mp4
The game is compatible with gamepads.
I'm lying, just remap the gamepad with qjoypad
demo_gamepad.mp4
- Smooth Gameplay
- Bot
- There are no impossible paths in the grass paths (there is always a passage between the trees)
- Scoring System, which notifies when the maximum score has been achieved
- Arrows - Move the player
- Space - Advances the map without moving the player
- Esc - Enter Pause mode
- Enter / Space - Select options within the Menus
You can download the game on project's releases.
As you can easily see on the demo, the goal was develop a clone of Crossy Road game with Gloss library from Haskell.
Trying to bring our past coding knowledge to the project, we tried at maximum modularize the code, and make it as clean as possible. We also tried to use the best practices of the functional programming paradigm.
$ git clone https://github.com/Darguima/Trivial-Road-LI1.git
$ git clone [email protected]:Darguima/Trivial-Road-LI1.git
To compile the code you can use cabal
:
$ mkdir TrivialRoad -p
$ rm -r ./dist-newstyle/build &> /dev/null
$ cabal build
$ mv ./src/Main ./TrivialRoad/trivialRoad
$ cp ./assets ./TrivialRoad -r
$ cp ./highscore.txt ./TrivialRoad
# Single Command
$ mkdir TrivialRoad -p; rm -r ./dist-newstyle/build &> /dev/null; cabal build; mv ./src/Main ./TrivialRoad/trivialRoad; cp ./assets ./TrivialRoad -r; cp ./highscore.txt ./TrivialRoad
It will generate a TrivialRoad
folder that contains all the necessary files for the game to run.
# Linux
$ ./TrivialRoad/trivialRoad
Now you can compress the folder and send it anywhere, without the need to have Haskell on other computers.
You can open the Haskell interpreter (GHCi) using cabal or directly in the interpreter.
- With
cabal
$ cabal repl
>>> main
- With GHCi (on root folder of the project)
$ ghci -i="src" -i="tests" src/Main.hs
>>> main
This project uses the HUnit library to run unit tests.
You can run the tests using one of the following alternatives:
- With
cabal
$ cabal test
- With GHCi
$ ghci -i="src" -i="tests" tests/Spec.hs
>>> runTestsT1 -- Correr os testes tarefa 1
>>> runTestsT2 -- Correr os testes tarefa 2
>>> runTestsT3 -- Correr os testes tarefa 3
>>> runTestsT4 -- Correr os testes tarefa 4
>>> main -- Correr todos os testes
- With the wrapper
runhaskell
$ runhaskell -i="src" -i="tests" tests/Spec.hs
You can generate the documentation with Haddock.
- With
cabal
$ cabal haddock --haddock-all
- With
haddock
$ haddock -h -o doc/html src/*.hs