Scala-Js Games
This is a collection of games ported from Java to Scala-Js: the source for each game is written in Scala, and cross compiled to run in the browser targeting the HTML5 Canvas. The original games can be found here and targeting Java/Swing. Although this is basically a complete rewrite, the user-facing side of the game should be exactly the same. Try out the 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
- Clone the repo
- Hit
sbt packageJS
- Open
/index-dev.html
in your favorite browser and play the games! - Hit
sbt optimizeJS
. This may cause SBT to run out of memory. See here for how to give it more. - Open
/index.html
in your favorite browser and play the games!
License
The MIT License (MIT)
Copyright (c) 2013 Li Haoyi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.