States

The states used are from Hump Gamestate, so make sure to read its documentation before you start. To get the current gamestate use: Gamestate.current()

Gamestates Editor,Play and Battle have the following in common

Variables

x,y

The current positions of the camera.

current_zmap

the active zmap.

scale

layers

Layers module link.

textureManager

Texture manager module link.

textureMapper

Texture mapper module link.

imageAdmin

The image module link.

shapeAdmin

Shape module link.

moduleAdmin

Module Admin link.

textAdmin

Text module link.

tool

The current active tool.

mainCanvas

The main canvas where everything except UI is drawn upon.

ui_keyControler

The ui key controller

CamerBox

The camera box HC shape.

ui

The ui_package used.

Functions

worldPos(x, y)
Parameters:x,y (numbers) – Position on screen
Returns numbers x,y:
 Position in the world.
camPos(x, y)
Param:floats x.y: Position in the world
Returns floats x,y:
 Position on the camera.
render()

Draws all of the items on the mainCanvas.

getTween()
Returns:Flux group; The flux group used for tweens within the gamestate.
parse()
Returns table:Editor items including shapes and modules etc.

Editor

Editor:renderRuler()
Returns:draws the ruler on the ruler canvas.
Editor:getMousePos()
Returns floats x,y:
 the mouse position.
Editor:getMod()
Returns floats x,y:
 modifiers for parallax from the current layer.
Editor:remakeCamera()

Recreates the camera shape, use it if you are setting scale etc, no need to use it when changing position.

Editor:navigation(KeyControler keycontrol1,keyControler keycontrol2,float dt)

Controls all of the navigation.

Editor:save(name)
Parameters:name (string) – saves the map with the name.
Editor:run()

Runs the game into Play mode.

Editor:load(name)
Parameters:name (string) – loads the map at name
Editor:refreshImageList()

Refreshes the image list if it is open.

Editor:getMapDir(tail)
Parameters:tail (string) – the tail string such as “/children/”
Returns string:directory.
Editor:pickImage(function)
Param:function(sheet,quad), executed when the appropriate sprite is selected.
Editor:pickLayer(function)
Param:function(zmap,layer), executed when the appropriate layer is selected.
Editor:pickSound(function) -- WORK IN PROGRESS!
Param:function(name,dir), executed when the appropriate sound is selected.
Editor:getUi()
Returns:the ui package used in the state.
Editor:newMap(name)
Parameters:name (string) – the name of the new map.

Variables:

dock

the Dock ui portion.

dropDown

The drop down menu.

quickSave

The quick save timer if it reaches zero the game is saved.

mx,my

The mouse position.

all_active

All of the active items, within and outside of CameraBox

Play

Play state is the main state, it is the platformer part of the game.

Functions

Play:getPlayer()
Returns:the active camera holder, aka the player.
Play:getScenes(map,initial)
Parameters:
  • map (string) – the map to query (optional).
  • initial (table) – the initial table filled with maps or empty (optional)
Returns table scenes:
 

the table full of scene locations in string format.

Play:OnBattleMode(team,player,ownTeam,cards)
Parameters:
  • team (table) – table with Ghosts, max: 5.
  • player (table) – the player instance
  • ownTeam (table) – Optional, the players team.
  • cards (table) – Optional, the players cards.

The table full of Ghosts should look like this:

{
   {name = string name
   dir = string directory
   _host = ghost -- Instance of loadGhost data}
}
Play:save(string name, Team)
Params string name:
 The name of the save.
Params Team:The team, same syntax as OnBattleMode()
Play:tweenCapture()

It is the capture tween, the effect that happens when you are about to enter the Battle mode.

Play:clampCamera()
Returns Camera:The camera unique to the current game.
Play:getCamera()
Returns Camera:The camera unique to the game, Doesn’t block the existing one though.
Play:releaseCamera()

releases the camera.

Play:switchMap(dir)
Parameters:dir (string) – the directory of the map.

Camera

The camera is a new class created when you either Play:getCamera() or Play:releaseCamera()

  • Variables
x,y the map position of the Camera.
  • Functions
Cam:updateCamera()
Returns numbers x,y:
 new x and y positions in the world.

You must redefine this function to set the appropriate positions.

Example usage:

local game = Gamestate.current()

local Cam = game:clampCamera(true)
local finished = false
Cam.modx = 0
Cam.mody = 0
game.tweenGroup:to(Cam,2,{modx = 100})
function Cam:updateCamera(dt)
    local x,y = self.x + self.modx,self.y + self.mody
    return x,y
end

-- some where else when finish = true,

if finish then
    game.tweenGroup:to(Cam,2,{modx = 0}):oncomplete(function()
        game:releaseCamera()
    end)
end

Battle

Battle is the RPG part of the game,

Battle has little to no functions at the moment, but please note that is soon subject to change.

As of right now it has little modding compatibility and will soon be rewritten.