GamesEngine.Physics.Velocity (games_engine v0.3.1)

Velocity module

Summary

Functions

Creates a new %Velocity{} struct with 0 speed in the x and y directions

Creates a new %Velocity{} struct based on a direction vector

Creates a new %Velocity{} struct based on a speed and heading Heading is expected in degrees

Types

@type t() :: %GamesEngine.Physics.Velocity{x: term(), y: term()}

Functions

@spec new() :: t()

Creates a new %Velocity{} struct with 0 speed in the x and y directions

@spec new({number(), number()}) :: t() | {:error, String.t()}

Creates a new %Velocity{} struct based on a direction vector

Link to this function

new(speed, heading)

@spec new(number(), number()) :: t() | {:error, String.t()}

Creates a new %Velocity{} struct based on a speed and heading Heading is expected in degrees