Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

The King

The game was originally created for FC_Jam#2 on PICO-8 fantasy console and published on itch.io

Welcome Game Game over

Run

clj -Sdeps '{:deps {io.github.Clojure2D/clojure2d-examples {:git/sha "81f7c8bd409e6328faa9f70e50c86217ecde174b"}}}' -X games.the-king.the-king/run-game

or load the games.the-king.the-king namespace and call run-game

Controls

  • z or x to start a game

In game:

  • left or right to rotate player
  • z or x or up to push
  • down to move backward

The goal

You have to push your lazy King through the map to marked target. You have to avoid: mud, water, snakes and hard pushing. The level of happiness of your king drops then. He's also bored when you stay too much time on the map.

Change the map, help king to grab the beer, and progress.

Mechanics

The terrain is bumpy and makes you move towards mud and water (the lowest level), big rocks are harder to go through. You move your king by hitting (elastic collision) him.

Map

The map is everytime different and based on noise (value, gradient or simplex - depending on the level)

Implementation details

  • Game is done using Clojure2d and Fastmath
  • Sprites are taken from PICO-8 implementation
  • Colors and fonts are the same as in PICO-8
  • No global state (atoms etc)
  • No optimization (probably boxed math and reflection is present)
  • No music
  • 5 game stages:
    • :welcome - intro
    • :bounce-in - map in and level indicator
    • :bounce-out - map out
    • :game - game itself
    • :game-over - game summary
  • two multimethods which are run 30 FPS, one method per stage:
    • update-game-state - main calculation, time progress etc
    • draw - draw frame
  • state change by calling change-state
  • game data is stored in one big hash-map
  • physics is simple force application with friction (force is generated by player hit and terrain)
  • hit is a perfect ellastic collision (like in billiard game)
  • map bounce in and out are based on easing functions