a2 / love-typescript-template

A template project to get started with a TypeScript LÖVE 2D project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LÖVE 2D TypeScript Project Template

A template LÖVE 2D TypeScript Project made possible with TypeScriptToLua.

Requires Yarn and LÖVE 2D.

love should be accessible from the command line. This guide specifies how to do that

You can use Use this template to clone this repo, or download it as a zip.

yarn                # install dependencies
yarn build          # build everything
yarn watch          # rebuild Lua files every time a TS file is saved (faster)
yarn start          # start the game

yarn fix:prettier   # tidies up written code

To distribute the game, zip the output in the game/ directory into a .love archive. See the game distribution wiki page for how to distribute this or check out love-release for a more streamlined process.

Importable files can be placed in the res/ directory and referenced them with res/[resource name].

e.g.

  • new file: res/input.txt
  • main.ts: love.filesystem.read("res/input.txt")

Notes

  • It is entirely possible to use existing Lua libraries for a LÖVE 2D project within your TypeScript code
  • TypeScriptToLua preserves some esnext behaviour. This means you can use Array.map and new Error(...)
  • GitHub projects can be imported and be tracked as a dependency with yarn add [username]/[repo]
  • The copyfiles command line can be used to copy other needed files into the game/ directory to compile a game (see scripts)
  • Index arrays at 0
  • Lua does not iterate over sparse arrays (arrays with empty values in the middle of them)

Links

About

A template project to get started with a TypeScript LÖVE 2D project

License:MIT License


Languages

Language:TypeScript 100.0%