This document is aimed at helping you adjust to the core changes that were made in the recent PSK update (1.0.0 to 1.1.0). Thankfully, most of the changes haven't actually messed with much, but there are a few "gotchas" that we need to gloss over.
Lets start with the new method of creating an actor, using the new "pskActor" object! pskActor is derived from t2dAnimatedSprite and employs a ground detection scheme similar to the one found in the behavior. Because it runs from source, it is much more efficient and allows you to have more actors in your scene at any given time.
ActorType |
The type of actor. |
AnimationData |
The datablock that stores custom animation data |
SoundData |
The datablock that stores custom sound data |
|
|
Gravity |
Amount of gravitic force applied to the actor |
MaxMoveSpeed |
The max speed the actor can travel |
GroundAccel |
Movement acceleration while running |
GroundDecel |
Movement deceleration while running |
AirAccel |
Movement acceleration while airborn |
AirDecel |
Movement deceleration while ariborn |
JumpForce |
The amount of force applied to the actor whilst jumping |
AllowJumpDown |
Allow jumping down through one-way platforms |
|
|
AllowBounce |
Allow bouncing |
BounceJumpTimeOut |
Max time between bouncing and performing a bounce jump |
|
|
AllowGliding |
Allow gliding |
GlideMaxFallSpeed |
Maximum fall speed while gliding |
GlideTimeOut |
Maximum amount of time spend gliding before reset |
|
|
AllowClimbing |
Allow climbing |
ClimbUpSpeed |
Movement speed while climbing up |
ClimbDownSpeed |
Movement speed while climbing down |
ClimbSideSpeed |
Movement speed while climbing sideways |
|
|
GroundCheckThreshold |
Y-Distance to check grounding |
GroundCheckMaxNormal |
Maximum slope size |
|
|
LadderAttachThreshold |
Distance that the actor has to be from the ladder before attaching |
LadderDetachTimeOut |
The time between detaching and being able to reattach to a ladder |
LadderJumpCoefficient |
The coefficient of the jump force applied while jumping from a ladder |
|
|
MaxHealth |
The max amount of health the actor can have |
MaxArmour |
The max amount of armour the actor can have |
ArmourModifier |
Amount of damage reduced whilst the actor has armour |
AllowRespawn |
Allow respawning after death |
Lives |
The number of lives left |
DeathTimeOut |
The time between dying and respawning |
DamageTimeOut |
The time between taking damage |
The above fields are enough to get your objects configured, but if you are going to modify your actors, you'll need to know some information about them:
Alive |
Is the actor alive? |
Armour |
Amount of armour the actor has |
Bouncing |
Are we bouncing now? |
Climbing |
Are we climbing now? |
Direction |
Direction the actor is heading |
Gliding |
Are we gliding now? |
Health |
Amount of health the actor has |
Jump |
Is the "jump" key being held down? |
OnGround |
Are we on the ground? |
Spawning |
Are we spawning? |
Speed |
The movement speed that we're traveling |
|
|
BounceTime |
The time that we last bounced |
DamageTime |
The time that we were last damaged |
DeathTime |
The time that we last died |
DirectionTime |
The time that we last changed direction |
GlideTime |
The time at we last started gliding |
JumpTime |
The last time that the actor jumped |
LadderDetachTime |
The time that we detached from a ladder last |
|
|
GroundComponent |
Store the ID of the ground component the actor is on |
GroundNormal |
The surface normal of the ground the actor is on |
GroundObject |
The ID of the ground object the actor is on |
GroundPoint |
The point of contact that the actor has with the ground surface |
JumpDownPlatform |
The ID of the platform that we ignore while jumping down |
LadderBehavior |
The behavior ID of the ladder we're attached to |
LadderObject |
The ID of the ladder the actor is attached to |
|
|
BounceCoefficient |
How high the actor bounces on a bounce jump |
InheritedVelocity |
The velocity that we inherit from external events |
RespawnPosition |
The position that the actor will respawn to |
It isn't until you see lists like the above, that you realise how much work goes into creating one of those little guys!
Most of the fields on the list are going to be familiar to you if you are familiar with the original ActorBehavior, so I will focus on the main additions to the list. Before we get to that, I'll give you an example of how to create a new pskActor object through script.
Creating and configuring a pskActor
You will need to create a new datablock to configure the actor.
datablock t2dSceneObjectDatablock(DrillActorTemplate)
{
Class = "DrillClass";
Size = "16.000 12.000";
Layer = "2";
CollisionPolyList = "-0.550 -0.500 0.170 -0.500 0.170 0.220 -0.190 0.700 -0.550 0.220";
ActorType = "Drill";
_Behavior0 = "AIControllerBehavior AIType Drill";
AnimationData = "DrillAnimationData";
SoundData = "DrillSoundData";
MaxMoveSpeed = 16;
GroundAccel = 1000;
GroundDecel = 1000;
AllowRespawn = false;
DeathTimeOut = 500;
};
Once the configuration datablock has been created, you need to create your scene object:
new pskActor(MyDrillActor)
{
SceneGraph = sceneWindow2d.getSceneGraph();
Config = DrillActorTemplate;
};
Thats it, pretty simple right? Creating an actor from the Level Editor is even easier! Drag out a reference image (just use anything that helps you identify that object as being an actor, I like to use the idle animation of the actor type that is going to be created). On this object, add the "SpawnPointBehavior" behavior to the object. Select "pskActor" from the "TargetType" field and then select the datablock you created from the "TargetObject" list.
Now onto a few of the property changes!
Important Updated Properties
ActorType
This field has been moved from ActorAnimationBehavior and renamed from AnimationSuffix to ActorType. Its role is not only to identify the appropriate animations for the actor, but it also replaces the role of the AIType field from AIController.
AnimationData
If your animation naming scheme does not conform to the PSK's convention, <ActorType><StateName>Animation, then you must specify each state's animation manually. You do this in a SimDatablock referenced by AnimationData. For example:
datablock t2dSceneObjectDatablock(DrillActorTemplate)
{
...
AnimationData = "DrillAnimationData";
...
};
datablock SimDataBlock(DrillAnimationData)
{
RunAnimation = "DrillIdleAnimation";
};
SoundData
Similar to the AnimationData field, we can use this datablock to specify the sounds for each state that this actor should use, as well as any properties it needs to use.
datablock t2dSceneObjectDatablock(DrillActorTemplate)
{
...
SoundData = "DrillSoundData";
...
};
datablock SimDataBlock(DrillSoundData)
{
InnerRadius = 20;
OuterRadius = 80;
RunSound = "DrillIdleSound";
};
As always, if I haven't covered anything or something needs clarifying let me know and I'll get right onto it.