Word Snap Starter Kit
This starter kit will allow you to rapidly write 'word snap' style games and edit puzzles for your game.
Also Included
This starter kit is made using a standard base that can be found in all current and future 'try before you buy' kits. Those parts are:
-
buttonMaker - Button builders for push, toggle, and radio buttons.
- Docs coming soon...
-
soundMgr - Basic sound manager that you can easily tweak and extend.
- Docs coming soon...
-
utils - Utilities module that includes tons of featues, including a button generator.
- Docs coming soon...
The Viewer
Basic Usage
local utils = require "easy.utils"
local wordSnap = require "easy.wordSnap"
local group = display.newGroup()
local back = display.newRect( group, centerX, centerY, fullw, fullh )
back:setFillColor(unpack(utils.hexcolor("#128223")))
local params =
{
tileColor = utils.hexcolor("#e96a5d"),
tileStroke = utils.hexcolor("FFFFFF"),
tileStrokeWidth = 2,
landColor = utils.hexcolor("#1b3679"),
landStroke = utils.hexcolor("#edff47"),
landStrokeWidth = 2,
}
wordSnap.setTileDimensions(60,60)
wordSnap.createViewer( group, centerX, centerY, "level_1_1.json", params)
The Editor
Basic Usage
local mode = "edit" -- edit view
if( mode == "edit" ) then
local utils = require "easy.utils"
require "presets.presets" -- For button maker
local wordSnap = require "easy.wordSnap"
wordSnap.setFonts( "viewer.ttf", "editor.ttf" )
wordSnap.setTileDimensions(60,60)
wordSnap.createEditor()
else
local wordSnap = require "easy.wordSnap"
wordSnap.setTileDimensions(60,60)
wordSnap.createViewer( nil, centerX, centerY, "level_1_3.json" )
end
Quick Reference
createEditor
wordSnap.createEditor( group )
- Creates and starts the editor.
- group - An optional display group to place all content in.
createViewer
wordSnap.createViewer( group, x, y, puzzleName, params )
- Creates a puzzle 'viewer'.
The 'viewer' is essentially a fully functional game instance that you can place anywherey you like, in any group you like.
- group - An optional display group to place all content in.
- x, y - < x, y > position of center of puzzle.
- puzzleName - Full name of puzzle, including the .json extension.
- params - A table of optional parameters.
- listener - Function to call when board is solved.
- landWidth, landHeight - Width and height of 'lands'.
- landStroke - Stroke width of land.
- landImage - Image to use for drawing lands. If none supplied, a rectangle is drawn.
- landColor - Fill color to use for land. Default is white.
- tileWidth, tileHeight - Width and height of 'tiles'.
- tileStroke - Stroke width of tile.
- tileImage - Image to use for drawing tiles. If none supplied, a rectangle is drawn.
- tileImages - If supplied, you are telling the module to look in this folder for the letter tiles.
- tileExtension - Optionally used with 'tileImages' parameter and must be either ".png" or ".jpg".
- tileColor - Fill color to use for tile. Default is white.
- letterFont - Font to use for letters if you're not supplying letter tiles.
- letterSize - Size of letters (only for non-letter tile case).
- letterColor - Color of letters (only for non-letter tile case).
Note: All puzzle definitions are assumed to be in the folder
~/puzzles/
.
getPuzzleInfo
wordSnap.getPuzzleInfo( puzzleName )
- Gets info about puzzle and returs it as a table.
- puzzleName - Full name of puzzle, including the .json extension.
Returned Table Fields
- rows - Number of rows in puzzle.
- cols - Number of colums in puzzle.
- width - Width of puzzle.
- height - Height of puzzle.
- sets - Numer of 'sets' in puzzle. i.e. Number of puzzle pieces.
Note: All puzzle definitions are assumed to be in the folder
~/puzzles/
.
resetLayoutToStart
wordSnap.resetLayoutToStart( instant )
- If you're running the viewer, this will set all puzzle pieces back to the starting (unsolved) position.
- instant - It set to
true
the pieces move instantly. Otherwise they transition to the start point if they are not already there.
setFonts
wordSnap.setFonts( vFont, eFont )
- Sets default font for viewer and/or editor.
- vFont - Viewer font. Pass
nil
to reset to default. - eFont - Editor font. Pass
nil
to reset to default.
setTileDimensions
wordSnap.setTileDimensions( width, height )
- Set the width and height of tiles.
- width, height - Width and height of tiles.
Important! -- If you are going to change this, be sure to set it to the same value while editing as you do during viewing or your puzzle layouts may look goofy.
stop
wordSnap.setFlySettings( newTime, newEasing )
- Changes the fly behavior for tiles that snap back to the unsolved position.
- newTime - New fly time in milliseconds.
- newEasing - New easing to use for the transition.
start
wordSnap.start( )
- If you are running the viewer, calling this enables touch interactions if they were previously disabled.
Posting Questions To The Forums
I will be providing help (exclusively) through the Corona SDK Forums. (Sorry: Direct e-mails and private messages will not be answered.)
When posting a question in the forums, be sure to follow these guidelines:
- Post to this forum: https://forums.coronalabs.com/forum/553-other-third-party-tools/
- Make sure the title starts with: Word Snap Starter Kit and includes a short and meaninful name for the the problem.
- In the body of the post give me clear, concise, and precise description or question.
~ The Roaming Gamer
Copyright © Roaming Gamer, LLC. 2008-2017; All Rights Reserved