Skip to content
/ deep Public

Add Z axis and drawing layers to Love2D (or any Lua framework)

License

Notifications You must be signed in to change notification settings

Nikaoto/deep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

			  __                         
			 /\ \                          
			 \_\ \     __     __   _____   
			 /'_` \  /'__`\ /'__`\/\ '__`\ 
			/\ \L\ \/\  __//\  __/\ \ \L\ \
			\ \___,_\ \____\ \____\\ \ ,__/
			 \/__,_ /\/____/\/____/ \ \ \/ 
			                         \ \_\ 
			                          \/_/ 

deep is a tiny library for queuing and executing actions in sequence.

This functionality can be used in multiple ways, one of which is for LÖVE, where you can use the Z axis when drawing.

Usage

Place deep.lua inside your project and require it:

deep = require "deep"

Queue actions

deep.queue(3, print, "wound!")
deep.queue(1, print, "It's just")
deep.queue(2, print, "a flesh")

Execute

deep.execute()

Prints:

It's just
a flesh
wound!

Documentation

deep.queue(i, fun, ...)

Queues a function for execution at index i

deep.queue(100, print, "Hello")
-- or
deep.queue(100, function() print("Hello") end)

Arguments:

  • i (number) - The index of the action, must be positive.
  • fun (function) - An anonymous or named function
  • ... (*) - The arguments of the passed named function

Usage:

  • With anonymous functions: deep.queue(400, function() hit(iron, 100) end)

  • With named functions: deep.queue(400, hit, iron, 100)

  • With multiple functions:

     deep.queue(1, function()
       print("Hello")
       print("World")
     end)

deep:execute()

Executes all of the queued actions

-- Will execute the actions in random order
deep.queue(math.random(10), print, "'Tis")
deep.queue(math.random(10), print, "but")
deep.queue(math.random(10), print, "a")
deep.queue(math.random(10), print, "scratch!")

deep.execute()

Demos

The demo files have small examples of how deep's different functions should be used. I suggest you check out each one of them to learn about the various edge cases and details of deep.

Here's what demo1 does: demo

About

Add Z axis and drawing layers to Love2D (or any Lua framework)

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages