Inspired from here. Left click to place trail, right click to place fire (try squiggling lots to get a loop started). Much of this code is adapted from here.