InputSystem:action_pressed

Routes an input to the relevant input handlers. The event seen by input listeners is a string with the "+action" format - where the + sign indicates the action is being pressed and action is the name of an action registered via set_bindings.

Usage

input_system:action_pressed(player_index, action)

Arguments

Name Type Description
player_index number Index identifying the player who emitted the input.
action string Action that was pressed (eg. jump).

Examples

local MyScene = Class("MyScene", crystal.Scene);

MyScene.init = function(self)
  self.ecs = crystal.ECS:new();
  self.input_system = self.ecs:add_system(crystal.InputSystem);
end

MyScene.action_pressed = function(self, player_index, action)
  self.input_system:action_pressed(player_index, action);
end

MyScene.action_released = function(self, player_index, action)
  self.input_system:action_released(player_index, action);
end

This site uses Just the Docs, a documentation theme for Jekyll.