Characters

From Open Surge Engine Wiki
Revision as of 19:04, 9 February 2011 by Alexandre (Talk | contribs) (Overview)

Jump to: navigation, search

Overview

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

See also: Level_specification#players

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 faster than that. If you set it to 0.5, it will accelerate by half of the default rate, and so on. 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"
    }
}