Skip to content

nelsonic/tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris (in elm!)

Tetris header image

Why?

Building games is the most "fun" you can have while learning how to program in a new language or platform!

What?

Our quest to follow the Elm Tetris Tutorial by "Captain Coder": https://youtu.be/GMSXYnMH1gg Tetris in Elm Tutorial

Tetris?

Tetris is familiar to most people that have played computer/video games...

Tetris Game Play GIF

If you have never played it, try now: https://tetris.com/play-tetris
And, read the history: https://en.wikipedia.org/wiki/Tetris

How?

0. Setup

Start by installing elm (if you do not already have it on your computer): https://guide.elm-lang.org/install.html
Ensure that you have a text editor installed, in our case we are using Atom: https://atom.io

We are also using elm-format to make the code look "elm-ish". In my case I had to:

npm install elm-format -g

AND

apm install elm-format

Then re-start Atom and try saving a .elm file and if it gets re-formatted, then everything worked.

If you get "stuck" installing the packages, google for the error message you see and if you are still stuck after 10mins of googling, open an issue on GitHub: https://github.com/nelsonic/tetris/issues

1. Run elm-reactor

In the /tetris directory run the elm-rector command. You should see:

terminal elm reactor

This runs a local web server on your computer that you can access by visiting in the browser: http://localhost:8000

elm reactor in chrome web browser

2. Type the initial code from the the Video

After trying to run the initial code shown in the tuturial:

module Block where

import Graphics.Element

main = Graphics.Element = show 42

elm-format re-formats it to:

module Block exposing (..)

import Graphics.Element


main =
    show 42

3. Install elm-graphics Package

The Tetris tutorial requires "Graphics": https://github.com/evancz/elm-graphics
In your terminal, type:

elm-package install evancz/elm-graphics

You should see something like this: elm-package install evancz/elm-graphics

Again, thanks to StackOverflow: https://stackoverflow.com/questions/41408360/what-happened-to-graphics-package-in-elm-0-18

About

Following the Elm Tetris Tutorial

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages