Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorPlayerInputMove
Behavior element behavior adding moving player input.
Keeps track of moving player input and applies them to actor locomotion. The type of locomotion can be set to one of three typical configurations.
This behavior can be used for human actor and vehicle movement.
This behavior can be used only once on an element.
Element class properties have the prefix playerInputMove.
.
Set walk speed in meters per second.
playerInputMove.speedWalk
1.25
0
<float name='playerInputMove.speedWalk'>1.5</float>
Set run speed in meters per second.
playerInputMove.speedRun
4
0
<float name='playerInputMove.speedRun'>6</float>
Set speed factor walking forward.
playerInputMove.speedFactorWalkForward
1
0
<float name='playerInputMove.speedFactorWalkForward'>6</float>
Set speed factor walking backward.
playerInputMove.speedFactorWalkBackward
1
0
<float name='playerInputMove.speedFactorWalkBackward'>6</float>
Set speed factor walking left.
playerInputMove.speedFactorWalkLeft
1
0
<float name='playerInputMove.speedFactorWalkLeft'>6</float>
Set speed factor walking right.
playerInputMove.speedFactorWalkRight
1
0
<float name='playerInputMove.speedFactorWalkRight'>6</float>
Set speed factor running forward.
playerInputMove.speedFactorRunForward
1
0
<float name='playerInputMove.speedFactorRunForward'>6</float>
Set speed factor running backward.
playerInputMove.speedFactorRunBackward
1
0
<float name='playerInputMove.speedFactorRunBackward'>6</float>
Set speed factor running left.
playerInputMove.speedFactorRunLeft
1
0
<float name='playerInputMove.speedFactorRunLeft'>6</float>
Set speed factor running right.
playerInputMove.speedFactorRunRight
1
0
<float name='playerInputMove.speedFactorRunRight'>6</float>
This behavior has no events.
This behavior requires no other behaviors.
This behavior does not required element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which tracks player moving input.
class MyElement extends BehaviorElementClass public var ECBehaviorPlayerInputMove playerInputMove func new() playerInputMove = ECBehaviorPlayerInputMove.new(this) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorPlayerInputMove'> <!-- optional: set locomotion type. default is 'natural'. allowed values are these: natural: default locomotion working best for actors moving in a natural way. The actor moves into the direction it is looking. The body is oriented into the walking direction if the actor is moving. fps: configuration useful for FPS type games where the actor is always oriented into the direction the player is looking. This configuration typically uses an 8-direction animator representing the actor moving into any direction relative to the looking direction. vehicle: configuration useful for vehicle type actors like tanks which move into the direction their body is oriented while allowing to freely look around. --> <string name='locomotionType'>natural</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>Color 1</string> </behavior> </elementClass>