Skip to content

Character setup

llafuente edited this page Aug 1, 2016 · 2 revisions

Character Setup

To create a character you have to configure at least its physics, input, movements.

Recommended structure.

  • Character (Character, Enemy)
    • Input (DefaultInput, AIInput...)
    • Actions (Every CharacterAction*)
    • Visual (Animator*)
      • HitBoxes
        • EnterAreas
        • DealDamage
        • RecieveDamage

Character Behaviour.

  • BoxCollider2D: The physical body. Used to calculate collisions, raycast origins, etc.
  • PlatformerCollider2D: How the Character collide with the world.
  • Character
  • CharacterHealth: Life/Damage handler.

Hitboxes

HitBox type: EnterAreas

This is the body used to check where the character is in Ladders, Grabbables, Liquids...

Should be smaller than EnterAreas HitBox, to make easy for the player to enter areas.

HitBox type: Recieve damage / Deal Damage

Where Character recieve or deal damage. NOTE: if they overlap don't forget to check Do not deal damage to sef.

Actions (Movements)

An Action need a Character and Input, It's recommended to create all Actions in a child node.

  • GroundMovement

    Ground horizontal movement. keyboard: right-left while OnGround

    NOTE: Slope rules are not here, are part of PlatformCollider2D

  • AirMovement

    Airborne horizontal movement. keyboard: right-left while not "OnGround"

  • Jump

    Variable Jump, also handle the rest of custom jumps. keyboard: space

  • Grab

    When Character enter a Grabbable area, first position player in the "desired position".

    Then Stop all movement.

    To Dismount press Down, or jump.

  • Ladder

    When a Character enter a Ladder and is pressing Up/Down, start climbing the ladder. keyboard: up/down

    Dismount pressing left/right or jumping.

  • LiquidMovement

    When a Character enter "enough" in a Liquid Liquid the liquid will oppose gravity and give the Bouyancy sensation.

    Character can move horizontally and exit Jumping or runnning in a slope.

  • Melee

    When an action (button) is held perform and attack.

    It's basically a succession of DamageArea overtime.

  • MovingPlatforms

    Fall through platforms while pressing down.

  • Projectile

    Fire projectiles with given offest and difference fire modes.

  • Slipping

    Slip when slope can't be climbed.

    While slipping player cannot move horizontally, it's forced down slope.

  • WallStick

    Stick to walls, and perform wall-jumps.

  • Push

    Push objects (Box)

    NOTE: Require CharacterActionGroundMovement

Input

DefaultInput

Keyboard and CnControls and WiiMote

AIInput

Fake input used by AI to perform actions. This make very easy to code AI because you just need to think in key press/up, and configure the AI the same way you main character works.

TestInput*

These inputs are for automated testing, not needed for your Game.

Clone this wiki locally