Difference between revisions of "Characters"

From Open Surge Engine Wiki
Jump to: navigation, search
m (Structure)
m (Structure)
Line 11: Line 11:
 
* the '''animations''' for each action the character performs: walk, run, jump, etc. See also: [[Sprites]];
 
* the '''animations''' for each action the character performs: walk, run, jump, etc. See also: [[Sprites]];
 
* the '''sound effects''' this character uses: jump, brake, etc.;
 
* the '''sound effects''' this character uses: jump, brake, etc.;
* optionally, the name of a '''companion object'''. If specified, the companion object, which automatically [[API_Reference#Cooperative_play|observes]] its owner character, can be used to develop special moves. '''IMPORTANT:''' the companion object should have the [[API_Reference#always_active|always_active]] flag specified.
+
* optionally, the name of a '''companion object'''. If specified, the companion object, which automatically [[API_Reference#Cooperative_play|observes]] its owner character, can be used to develop special moves. This object is spawned when the players are spawned. '''IMPORTANT:''' the companion object should have the [[API_Reference#always_active|always_active]] flag specified.
  
 
== Example ==
 
== Example ==

Revision as of 18:29, 9 February 2011

Overview

Characters are human-readable .chr files located in the characters/ folder. They're used to create playable characters.

Structure

.chr files contain the following information:

  • the name of the character;
  • the multipliers. These values are used to specify how fast a character runs, how high it jumps, how fast it accelerates, etc. For example, if you set the acceleration to one, it will accelerate at the default rate (set by the game engine). If you set it to two, it will accelerate two times fast than that. If you set it to 0.5, it will accelerate two times slower than that, and so one. By default, all the multipliers are set to 1.0;
  • the animations for each action the character performs: walk, run, jump, etc. See also: Sprites;
  • the sound effects this character uses: jump, brake, etc.;
  • optionally, the name of a companion object. If specified, the companion object, which automatically observes its owner character, can be used to develop special moves. This object is spawned when the players are spawned. IMPORTANT: the companion object should have the always_active flag specified.

Example

// ---------------------------------------------------------------------------
// Open Surge Engine
// http://opensnc.sourceforge.net
//
// File:   characters/surge.chr
// Desc:   character definition: Surge
// Author: OS Team
// ---------------------------------------------------------------------------

character "Surge"
{
    companion_object                ".surge_companion"
    
    multipliers
    {
        acceleration                1.0
        deceleration                1.0
        topspeed                    1.0
        jump                        1.0
        jumprel                     1.0
        gravity                     1.0
        rollthreshold               1.0
        brakingthreshold            1.0
    }
    
    animations
    {
        sprite_name                 "SD_SURGE"
        stopped                     0
        walking                     1
        running                     2
        jumping                     3
        springing                   13
        rolling                     3
        pushing                     14
        gettinghit                  11
        dead                        8
        braking                     7
        ledge                       10
        drowned                     9
        breathing                   12
        waiting                     15
        ducking                     4
        lookingup                   5
        winning                     10
        ceiling                     16
    }
    
    samples
    {
        jump                        "samples/jump.wav"
        roll                        "samples/roll.wav"
        death                       "samples/death.wav"
        brake                       "samples/brake.wav"
    }
}