class_name PlatformerActorAbilities extends Node ## Defines the abilities of an actor with platformer-like movement ## @remarks ## If this class is placed in the components set of an actor using the platformer actor ## controller, the actor controller will use the abilities defined here for the actor ## ## Using the ability definition, you can control acceleration, top speed, jump height, ## acrobatics and other properties of an actor. This enables you to configure actors ## from human-analog movements up to high-speed megaman-like movements and beyond. # ----------------------------------------------------------------------------------------------- # ## How the character moves from the squatting stance enum SquatMovementMode { ## The character is not allowed to moved around while squatting PROHIBIT, ## Movement while squatting results in slow sneaking walk ## @remarks ## Many first and third person games allow characters to move silently, ## lowering their stance for careful foot placement. SNEAK, ## Movement while squatting results in going onto hands and feet ## #remarks ## The character will movement on hands and feet, allowing him/her to clear ## long obstacles such as tunnels. CRAWL } ## How the character deals with ledges enum LedgeHangMode { ## The character is not allowed to hang onto the respective ledge PROHIBIT, ## The character can hang from the respective ledge but not climb it ## @remarks ## This is typically used for poles, bars and other ledges that provide no ## support for the character's feet. HANG_ONLY, ## The character can hang and climb onto the respective ledge ## @remarks ## This is typically used for walls where the character can hang onto the top ## of the wall and pull him/herself up. HANG_AND_CLIMB } # ----------------------------------------------------------------------------------------------- # ## Number of jumps the character can do (resets upon ground contact) ## @remarks ## Setting this number to zero prevents the character from jumping at all, ## a value of 1 would allow normal jumping off the ground at 2 would allow ## for one "air-jump" where the character gets an upwards impulse in mid-air. ## ## Running off a platform also counts as one jump, so with this value set to 2, ## after falling off a platform, the character can only jump off in mid-air once. export(int, 0, 4) var jump_count : int = 1 ## How high the character can jump with a normal jump ## @remarks ## Player-controlled characters can control their jump high by how long the jump ## key is held. This is the maximum height the character will achieve when ## the jump key is not released until the apex of the jump or later. export(float, 0.1, 20) var jump_height : float = 2.0 ## How high the character can jump with a super jump ## @remarks ## A super jump is done from when squatting and allows the character to jump ## extra high, but without much horizontal momentum (and leaving the character ## vulnerable while stopping and preparing the jump). export(float, 0.1, 20) var super_jump_height : float = 3.0 ## How much the character can be controlled during a jump or fall ## @remarks ## A factor of 1.0 means that the player can control the character's horizontal ## movement in the air just as good as on the ground, a factor of 0.0 would prevent ## the player from altering the character's trajectory at all after jumping off. export(float, 0.0, 1.0) var air_control_factor : float = 1.0 ## How fast the character moves horizontally when sneaking export(float, 1.0, 100.0) var sneaking_speed : float = 5.0 ## How fast the character moves horizontally when walking export(float, 1.0, 100.0) var walking_speed : float = 10.0 ## How fast the character moves horizontally when running export(float, 1.0, 100.0) var running_speed : float = 15.0 ## How fast the character moves horizontally when dashing export(float, 1.0, 100.0) var dashing_speed : float = 25.0 ## How quickly the character accelerates ## @remarks ## This goes for all movement speeds, so if the user holds the sprint key, ## the character will accelerate quicker, still reaching the full speed ## within this time. export(float, 0.1, 2.0) var seconds_to_full_speed : float = 0.25 ## How long the jump button needs to be held for maximum jump height ## @remarks ## If this is set to 0, the actor will always jump to the maximum height ## without allowing the player to make smaller jumps. Other values indicate ## the time for which the player has to hold the jump key to achieve maximum ## height, allowing for smaller jumps by pressing the jump key for a shorter duration. ## ## This works by 'boosting' the jump during the initial stage (applying ## the required upwards force over a small time frame) rather than applying the full ## force as a single impulse. Having extremely long boost durations will ## not work because the impulse then becomes too small and the character looks ## like it is jetpacking. export(float, 0.0, 1.0) var jump_boost_duration : float = 0.25 ## Speed at which the character can slide across the floor ## @remarks ## This is an action-movie styled slide where the character throws him/herself ## onto the ground from a run and slides a short distance across the ground, ## possibly clearing an obstacle or evading a bullet. ## ## Setting the required speed to infinity effectively disables floor sliding. export(float) var speed_for_floor_flide : float = INF ## Whether the character can move extra fast by sprinting ## @remarks ## This is a simple sprint function that makes the character move faster when ## the player holds the 'sprint' button. export(bool) var can_sprint : bool = false ## Whether the character is able to burst into a high speed slide ## @remarks ## Dashing is a popular ability made famous by the Megaman games. The character ## will assume a horizontal pose and receive a boost in speed for a short moment, ## allowing him/her to slide under obstacles or cross a gap at high speed. export(bool) var can_dash : bool = false ## How far the actor will dash when the dash key is pressed export(float, 0.0, 10.0) var dash_distance : float = 2.0 ## Whether the character can dash in mid-jump export(bool) var can_air_dash : bool = false ## Whether the player can jump off walls export(bool) var can_wall_jump : bool = false # Decide this via a predicate function? Some walls work, some don't. #public Predicate IsJumpableWall; # Decide this via a predicate function? Some walls work, some don't. #public Predicate IsHangableWall; ## Whether the character can slide down on a wall ## @remarks ## If this is set with prohibited, pressing into a wall will ## always have the character slide down said wall. With ## enabled, pressing into the wall will fix the character and sliding will only occur if ## the 'down' key is pressed at the same time. export(bool) var can_wall_slide : bool = false # Decide this via a predicate function? Some walls work, some don't. #public Predicate IsSlideableWall; ## Whether the character is able to hang on the top of a wall ## @remarks ## How the character handles walls where he/she is able to grab the top of ## the wall with his/her hands. See the documentation of the ## enumeration for an exaplanation of the options. export(LedgeHangMode) var wall_hanging = LedgeHangMode.PROHIBIT ## Whether the character is able to hang onto a floating obstacle ## @remarks ## How the character handles floating obstacles he/she is able to grab ## the top of but has no foot support. Things like poles and floating platforms. ## See the documentation of the enumeration for ## an exaplanation of the options. export(LedgeHangMode) var pole_hanging = LedgeHangMode.PROHIBIT ## Whether the character can squat, lowering his/her height ## @remarks ## This is an ability normally used for bullet avoidal. The character will ## assume a squatting stance (knees bent, upper body upright). Together with ## it could also be used for silent movement. export(bool) var can_squat : bool = false ## How movement is handled while the character is squatting ## @remarks ## See the documentation of the enumeration ## for an explanation of the various modes. export(SquatMovementMode) var squat_movement = SquatMovementMode.PROHIBIT # ----------------------------------------------------------------------------------------------- # ## Ignore this method, it's only there to suppress warnings about unused variables func _we_hate_compiler_warnings(): jump_count = 12345 jump_height = 12.34 super_jump_height = 43.21 air_control_factor = 0.123 sneaking_speed = 1.2 walking_speed = 3.4 running_speed = 5.6 dashing_speed = 7.8 seconds_to_full_speed = 1.234 jump_boost_duration = 0.123 speed_for_floor_flide = 12.34 can_sprint = true can_dash = true dash_distance = 1.2 can_air_dash = true can_wall_jump = true can_wall_slide = true wall_hanging = LedgeHangMode.HANG_AND_CLIMB pole_hanging = LedgeHangMode.HANG_ONLY can_squat = true squat_movement = SquatMovementMode.SNEAK