Movement:set_speed

Sets how fast this entity can move. This can also specified as a constructor argument.

Usage

movement:set_speed(speed)

Arguments

Name Type Description
speed number Movement speed in pixels / s.

Examples

local ecs = crystal.ECS:new();
ecs:add_system(crystal.PhysicsSystem);

local entity = ecs:spawn(crystal.Entity);
entity:add_component(crystal.Body);
entity:add_component(crystal.Movement);
entity:set_speed(100);
print(entity:speed()); -- Prints "100"

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