Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 2.02 KB

README.md

File metadata and controls

39 lines (29 loc) · 2.02 KB

Scala.js Games (Scala 3)

This is a collection of games ported from Scala 2 to Scala.js (Scala 3): the source for each game is written in Scala, and Scala.js cross compiled to run in the browser targeting the HTML5 Canvas. The original games can be found here and targeting Scala 2.

Live demo

The games are, in order:

  • Asteroids: shoot down the asteroid swarms and avoid getting hit!
  • Astrolander: bring your lander to a a gentle landing on flat ground before you run out of fuel.
  • Snake: eat apples to grow long and don't crash into walls!
  • Pong: outsmart your AI opponent to get the ball past his paddle (right) to score points!
  • Brick: use your paddle to bounce the ball up, destroying all the bricks before you run out of balls.
  • Tetris: collect points by clearing rows and don't let the screen fill with blocks.

The controls are generally up-down-left-right and spacebar; they aren't very complex games. Click on a game to start playing and click somewhere else to pause it.

How to build

  • Install sdkman - or, make sure to pick the correct java version (see .sdkmanrc).
  • Install nvm - or, make sure to pick the correct node version (see .nvmrc).
  • Install sbt.
  • Clone the repo.
  • Run sbt fastLinkJS (just to make sure the app compiles).
  • Run npm install to install the js dependencies.
  • Run npm run dev to launch the dev server, then, open http://localhost:3000 to load the app.
  • Run npm run build to prepare the production build.

Scala.js bundle size

The bundle size is ~600kb, ~100kb compressed:

sjs-games-code-size