YesNoOk
avatar

Basic Parts of a State (CNS) (Read 1074 times)

Started by Just No Point, September 30, 2015, 04:01:50 pm
Share this topic:
Basic Parts of a State (CNS)
#1  September 30, 2015, 04:01:50 pm
  • ******
    • www.justnopoint.com/
Note: This section assumes you have at least browsed the documentation of AIR files, and understand the concepts of animation, as know the meaning of key words and phrases such as action and element of an action.

Here is a short example state for P1:

Code:
[Statedef 200]
type = S
physics = S
movetype = I
ctrl = 0
anim = 200
velset = 0

[State 200, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
This state plays back the Action 200 of P1's animation, and returns P1 to his standing state after the animation has ended. In this case, assume Action 200 has a finite looptime. That is, Action 200 does not have any elements with time equal to -1.

At this point, you do not need to worry about the details. Let us begin by knowing what a state consists of.

All states must have a single Statedef section and one or more State sections.

Statedef contains the starting information of a state, such as what kind of state it is (standing, crouching, in the air) and what kind of move he is doing (attacking, idling.)

Each State section is referred to as a state controller, or a controller for short. Controllers tell the program what to do to P1, and when to do it. There are many kinds of controllers, each with its own function. For example, there are controllers to change the players position or velocity, define the effects of attacks, create projectiles, switch between animation Actions, change states, and so on. Each controller must have at least one trigger. A trigger is an event that causes the controller to be activated. Examples are: trigger at the start of the state, trigger at the end of the animation (as seen in the example State above), trigger on an element of an animation Action, trigger when P2 is within a certain range of P1, and so on.