Skip to content
Dmitro Szewczuk edited this page Oct 21, 2017 · 9 revisions

Comments to using Cerium

  • Cerium is collecting data from XML files, all Persons, Scenes and Prop should be storaged at res/scenes.xml, game settings at res/settings.xml and resources at res/data.xml
  • All resources files should be storaged at appropriate catalogs, like here
  • By moving and rotating Person, the all children are moving and rotating too.
  • VertexArray is a surface on which it's possible to place texture.
  • Buttons doesn't need VertexArray to be placed.
  • Scriptable Prop adding feature of Scripting to Person. To modify the Person where the Scriptable is, just use one of methods from this table (example below)
  • RigidBody Prop adding feature of colliding and gravitation. The Person will fall until it doesn't collides with other Person with RigidBody.
  • While writing scripts, try to not declaring variables (by using methods like vec2:new()) in update function. Do it like this script

Welcome to the Cerium scripting wiki!

You can writing scripts for Cerium only in lua language. To edit scripts you can use many of text editors like Notepad++ or else text editors with support of lua syntax like Sublime Text 3 or Atom.

The pattern of lua script -

-- Function running once, at start of game
function init()

end


-- Function running non-stop
function update(deltaTime)

end

The very simple movement script -

local speed = 100

-- Function running once, at start of game
function init()

end


-- Function running non-stop
function update(deltaTime)
    if eventManager.isKeyPressed(KEY_RIGHT) then
        this.move(vec2.new(speed * deltaTime, 0))
    elseif eventManager.isKeyPressed(KEY_LEFT) then
        this.move(vec2.new(-speed * deltaTime, 0))
    elseif eventManager.isKeyPressed(KEY_UP) then
        this.move(vec2.new(0, -speed * deltaTime))
    end
end
Clone this wiki locally