khrj / hackcraft

Voxel game written for sprig: https://sprig.hackclub.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image of hack craft with a tree built using wood and leaves and the player standing to the right

Hack Craft

Voxel game written for sprig




Contents

Controls

Global Controls

  • a to move left
  • d to move right
  • w to jump
  • Hold s to clear map

Normal Mode

  • k to place block (to right if on ground, below if in air)
  • l to mine block (first which exists in this order: right, below, left, above)
  • s to enable mine mode
  • i to enable inventory mode
  • j to enable build mode

Mine mode and build mode

  • i to place/break top
  • l to place/break right
  • j to place/break left
  • k to place/break bottom
  • s to exit mode

Inventory mode

  • j to go left
  • l to go right
  • s to exit mode

Development

Install nodejs and use npm to run scripts, like so:

npm run script-name

The following scripts are available

  • compile - Compiles typescript to javascript
  • rollup - Bundles javascript into one file
  • serve - Serves bundled javascript over http
  • open - Opens created javascript in the sprig editor. The editor will automatically reload and run your changes
  • watch - Watches and rebuilds javascript on changes
  • dev - Runs the server and opens the editor, while also watching for changes

In most cases, you will just need to run

npm run dev

Template

You can use this commit as a generic template to use in your own sprig project. It adds the following features to sprig:

  • TypeScript support (via tsc)
  • Multi-file support (via rollup)
  • Live reload (via serve, open, nodemon and sprig's watch param)

About

Voxel game written for sprig: https://sprig.hackclub.com/


Languages

Language:TypeScript 95.2%Language:Nix 2.5%Language:JavaScript 2.3%