Cherry is an open source starter provided as a CoronaSDK App to help building your Game.
- Introduction
- Usage
- Libraries
- Starters
- Components
- Music and Sounds
- License
- Third Parties
- Games using Cherry
You may use Cherry as a base, or to pick components from, in order to start your own game. Cherry provides the following facilities and libraries:
- clone Cherry next to your project, and symlink it to your project root
ln -s ../Cherry Cherry - add your env folder with your en settings
- add a
main.luawith justrequire 'src.app' - add a
src/app.luaand requireCherryinside
CHERRY = require 'cherry.cherry'
- then call
App.start()with your options
App:start({
name = 'YourGame',
version = '1.0',
})
A typical tree should be :
βββ Cherry
βΒ Β βββ _images
βΒ Β βββ app
βΒ Β βββ cherry.lua
βΒ Β βββ components
βΒ Β βββ engine
βΒ Β βββ libs
βΒ Β βββ screens
β
βββ YourGame
βΒ Β βββ CBE
βΒ Β βββ Cherry -> ../Cherry
βΒ Β βββ assets
βΒ Β βββ build.settings
βΒ Β βββ config.lua
βΒ Β βββ env
βΒ Β βββ main.lua
- Look in cherry.app.App to see what you may override with
App:start(options) - Look in cherry.engine.Game to see what you may override with
Game:YourStuff()
- env files simple example: development.json
{
"silent": true,
"view-testing": "Playground"
}
- adding custom screens
- extending/overriding
engine.Game
- setting custom bg
- setting custom gravity
- defining colors
- defining analytics ids
- defining facebook ids
- defining ios id
Either use these components within the full workflow or pick them one by one to use it in your own game.
See below for the complete list and documentation for each component.
A Screen implements the Composer library.
- Start by creating a new
screen, for instance duplicate the simplest onesrc/screens/Playground.lua - Register your new screen in the Router :
YOUR_NEW_SCREEN = 'YourNewScreen' - Now you can open your screen from anywhere calling :
Router:open(Router.YOUR_NEW_SCREEN)
- Each
modelshould implementnewandshowfunctions, for instance read how Item is built. - Register your model in main.lua :
YourModel = require 'src.game.models.YourModel' - Use
YourModel:new()during theLevelDrawerparsing - Use
YourModel:show()during theGamerendering
An animated progress bar.
-
Code : copy and require
src/components/ProgressBar.lua(example in Cherry) andsrc/components/Icon.lua -
assets : you need to copy the assets from
_/gui/progress-bar(and credit GraphicBurger see Third Parties)
- init the ProgressBar
local progress = ProgressBar:new()
- use parameters to draw the ProgressBar
progress:draw({
parent = self.display,
x = 30,
y = 30,
width = 200,
height = 30,
path = 'cherry/_images/game/item/gem.png'
})
- either add the
valuewithin the previous parameters for a static bar, or init the bar from a startup percentage :
progress:set(0)
- then ask the animation to start and reach the required percentage (here 88%)
progress:reach(88)
Apply animated arrows to focus any DisplayObject.
You can choose one to 4 arrows, showing your item or from your item.
-
Code : copy and require
src/components/Focus.lua(example in Cherry). -
assets : you need to copy the assets from
_/gui/items/arrow.right.png(and credit GraphicBurger see Third Parties)
The simplest focus :
Focus(item, true)
Choose arrow positions : set all to false, and set the ones you want in [up, down, left, right]
Focus(item, {
all = false,
bottom = true,
up = true
})
Choose arrow ways : set type to from-center or show-center (default)
Focus(item, {
all = false,
right = true,
type = 'from-center'
})
You can combine focus to place arrows to/from and where you want:
Focus(item, {
all = false,
right = true,
type = 'from-center'
})
Focus(item, {
all = false,
left = true,
type = 'show-center'
})
A custom ScrollView with an API to add and remove elements, and, wait for it... an animated attached scrollbar !
-
Code : copy and require
src/components/Scroller.lua(example in Cherry) -
assets : you need to copy the assets from
_/gui/scroller(and credit GraphicBurger see Third Parties)
Init a Scroller with the same parameters as a ScrollView
You may add the following parameters :
handleHeight: if set, your scrollbar height is fixed the value. if not, the height depends on the number of elements you have inserted.gap: the height between the elements
local scroller = Scroller:new({
parent = self.parent,
top = self.top + 7,
left = self.x - self.width * 0.45,
width = self.width * 0.9,
height = self.height - 22,
gap = display.contentHeight*0.05,
handleHeight = display.contentHeight*0.07,
horizontalScrollDisabled = true,
hideBackground = true
})
You can now insert/remove whatever you need in the scroller, the scrollbar is refreshed dynamically
local element = scroller:insert(anyDisplayGroup)
scroller:remove(element)
scroller:removeAll()
Use 2 background images to switch between dark and light modes.
- copy and require
src/components/Background.lua(example in Cherry)
-
Background:init() at your App startup to prepare your 2 pictures.
-
use
Background:darken()andBackground:lighten()wherever you need in your app to switch modes.
todo, read the code to understand the API
todo, read the code to understand the API
todo, read the code to understand the API
Many libraries to provide easy tooling for your app :
- screen routing
- game Camera
- touch controller
- sound library (music + effects)
- an API to register effects from CBEffects.
- user profile and game status
- google analytics events (a lot are already plugged in the workflow)
Courtesy of VelvetCoffee, you may use the samples from /assets/sounds for your own game, providing you credit VelvetCoffee for the work and link to :
https://soundcloud.com/velvetcoffee
You may use Cherry or a part of it in a free or commercial game or app, providing you follow the BSD crediting requirements, provided in the project LICENSE
- Cherry uses the awesome particle effects provided by CBEffects.
- There are some adapted functions from Underscore.Lua
- Mobile GUI assets from GraphicBurger
- Avatars from Tiny Speck
- Profile icon designed by Miguel C Balandrano
- Phantoms released on November 2015 as the actual source for cherry.