I usually find myself typing out the same handful of lines of code every time I need to start a new game in LÖVE, so I thought I'd share a snippet of code I paste into the main.lua file every time I start.
- Establish lg = love.graphics
- Establish lk = love.keyboard
- Establish la = love.audio
- Establish lm = love.mouse
- Set the aspect ratio to be 800x500 (a 16x10 aspect ratio)
- Set the Random Seed
- Set the default scaling algorithm to be absolute instead of blurring
There are also a handful of small functions I find myself using a lot.
- Distance between two points
- Shuffle a Table
- Flip a coin to return 1 or -1
- Generate a random float
- Replay a sound
- Access a character in a string like an item in an array (e.g. myString is y)