class Prism::PlayerMovement

Overview

This adds player like movement to an Entity. You'll be able to control the entity using the keyboard and perform some basic actions.

Included Modules

Defined in:

prism/stdlib/player_movement.cr

Constant Summary

GRAVITY = -50.0_f32
JUMP_POWER = 30_f32
RUN_SPEED = 100_f32
TURN_SPEED = 160_f32
WALK_SPEED = 20_f32
Y_AXIS = Vector3f.new(0, 1, 0)

Instance Method Summary

Instance methods inherited from module Prism::InputReceiver

input!(tick : RenderLoop::Tick, input : RenderLoop::Input, entity : Crash::Entity) input!

Instance methods inherited from module Prism::Adapter::GLFW

run(title : String, game : Prism::Engine, frame_rate : Float64, width : Int32, height : Int32)
run(title : String, game : Prism::Engine, frame_rate : Float64 = 60)
run

Instance Method Detail

def detect_terrain!(entity : Crash::Entity, terrain : Crash::Entity) #

Called by the terrain system so we can check the terrain height of the entity. this is a rudimentary form of collision detection.


[View source]
def input!(tick : RenderLoop::Tick, input : RenderLoop::Input, entity : Crash::Entity) #
Description copied from module Prism::InputReceiver

Receives input events from the InputSubscriber


[View source]