Difference between revisions of "Characters"

From Open Surge Engine Wiki
Jump to: navigation, search
m (Structure)
m (Structure)
Line 13: Line 13:
 
* 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 can be used to develop special moves. This object is spawned when the players are spawned.
+
* optionally, the name of a '''companion object'''. If specified, the companion object can be used to develop special moves. This object is spawned when the player is spawned.
 
** '''Note 1:''' the companion object should have the [[API_Reference#always_active|always_active]] flag specified;
 
** '''Note 1:''' the companion object should have the [[API_Reference#always_active|always_active]] flag specified;
 
** '''Note 2:''' you usually want to make the companion object [[API_Reference#Cooperative_play|observe]] its owner character.
 
** '''Note 2:''' you usually want to make the companion object [[API_Reference#Cooperative_play|observe]] its owner character.

Revision as of 01:11, 12 February 2011

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 by 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 can be used to develop special moves. This object is spawned when the player is spawned.
    • Note 1: the companion object should have the always_active flag specified;
    • Note 2: you usually want to make the companion object observe its owner character.

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"
    }
}