https://github.com/subsoap/vita
A generic energy / life system for Defold
https://github.com/subsoap/vita
defold defold-game-engine
Last synced: about 1 month ago
JSON representation
A generic energy / life system for Defold
- Host: GitHub
- URL: https://github.com/subsoap/vita
- Owner: subsoap
- License: cc0-1.0
- Created: 2018-02-17T20:58:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-19T05:18:24.000Z (over 7 years ago)
- Last Synced: 2025-05-10T05:52:49.819Z (about 1 month ago)
- Topics: defold, defold-game-engine
- Language: Lua
- Size: 126 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-defold - Vita
README

# Vita
A generic energy / life system for DefoldVita is for games where you use an auto-regenerating health / heart / life / energy type of system for accessing content such as levels. The resource will regenerate in real world time as the player leaves the app running or has it closed. Vita supports as many resources as you want to have in your game so that you can have some resources which recharge quickly and other more special ones which recharge slowly.
## Installation
You can use Vita in your own project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:https://github.com/subsoap/vita/archive/master.zip
Once added, you must require the main Lua module in scripts via
```
local vita = require("vita.vita")
```## Tips
Some games use energy. Some use hearts. Which should you use? Generally an energy system is better because it allows you to price events in different energy amounts while users may not like that events cost multiple hearts. But some games do not need that price flexibility and so can use a simple heart system where one heart is one attempt at a level.Generally if you use a heart system you only remove a heart if they fail an attempt (and thus usually have a lower number of total hearts). But with an energy system you remove the energy with every attempt no matter if they win or lose.