Skip to content

Commit

Permalink
Adds info on combo getters
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Sep 2, 2023
1 parent 920ee6a commit 406cc95
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Functions (Creating Combos)
# Functions (Combo Parameters)

 

Expand Down
160 changes: 160 additions & 0 deletions docs/6.1/Functions-(Combo-Getters).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Functions (Combo Getters)

 

## …combo_get_phase_count

`input_combo_get_phase_count(comboName)`

<!-- tabs:start -->

#### **Description**

**Returns:** Integer, the number of phases in the combo definition

|Name |Datatype|Purpose |
|-----------|--------|---------------------------|
|`comboName`|string |Name of the combo to target|

#### **Example**

```gml
//Form a string to show what phase the "fireball" combo is in
//This'll help the player learn the combo step by step

var _string = "Phase "
+ string(input_combo_get_phase("fireball"))
+ " of "
+ string(input_combo_get_phase_count("fireball"));

draw_text(10, 10, _string);
```
<!-- tabs:end -->
&nbsp;
## …combo_get_phase
`input_combo_get_phase(comboName, [playerIndex=0])`
<!-- tabs:start -->
#### **Description**
**Returns:** Integer, which phase the player is currently waiting to complete
|Name |Datatype|Purpose |
|---------------|--------|----------------------------------------------------|
|`comboName` |string |Name of the combo to target |
|`[playerIndex]`|integer |Player to target. If not specified, player 0 is used|
#### **Example**
```gml
var _phase = input_combo_get_phase("yanling");
if (_phase >= 3)
{
//Calculate the number of particles we should create
//As the "yanling" combo proceeds we'll create more particles
var _density = (_phase - 2)*3;
pfx_fire_generate(x, y, _density);
}
```

<!-- tabs:end -->

&nbsp;

## …combo_get_new_phase

`input_combo_get_new_phase(comboName, [playerIndex=0])`

<!-- tabs:start -->

#### **Description**

**Returns:** Boolean, whether a new phase was entered this step

|Name |Datatype|Purpose |
|---------------|--------|----------------------------------------------------|
|`comboName` |string |Name of the combo to target |
|`[playerIndex]`|integer |Player to target. If not specified, player 0 is used|

#### **Example**

```gml
if (input_combo_get_new_phase("hi jump kick"))
{
if (input_combo_get_phase("hi jump kick") == 3)
{
//If we've triggered a jump then swap over to a special sprite
sprite_index = spr_combo_hjk_special_jump;
}
}
```

<!-- tabs:end -->

&nbsp;

## …combo_get_charge

`input_combo_get_charge(comboName, [playerIndex=0])`

<!-- tabs:start -->

#### **Description**

**Returns:** Number, the charge time for the most recently encountered charge phase

|Name |Datatype|Purpose |
|---------------|--------|----------------------------------------------------|
|`comboName` |string |Name of the combo to target |
|`[playerIndex]`|integer |Player to target. If not specified, player 0 is used|

#### **Example**

```gml
if (input_check_pressed("shockwave aoe"))
{
var _inst = instance_create_layer(x, y, layer, obj_shockwave);

if (input_combo_get_charge("shockwave aoe") > 25)
{
//If the combo was charged longer than 25 frames, use the bigger collision sprite
_inst.sprite_index = spr_shockwave_aoe_big;
}
}
```

<!-- tabs:end -->

&nbsp;

## …combo_get_direction

`input_combo_get_direction(comboName, [playerIndex=0])`

<!-- tabs:start -->

#### **Description**

**Returns:** Number or `undefined`, the determined direction for the combo's execution

|Name |Datatype|Purpose |
|---------------|--------|----------------------------------------------------|
|`comboName` |string |Name of the combo to target |
|`[playerIndex]`|integer |Player to target. If not specified, player 0 is used|

#### **Example**

```gml
if (input_check_pressed("fireball"))
{
var _inst = instance_create_layer(x, y, layer, obj_fireball);
_inst.direction = input_combo_get_direction("fireball");
}
```

<!-- tabs:end -->
118 changes: 118 additions & 0 deletions docs/6.1/Functions-(Combo-Parameters).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Functions (Combo Parameters)

&nbsp;

In Input, a "combo" is a sequence of inputs that need to be executed in a timely fashion to trigger some sort of player action. These are ubiquitous (and perhaps synonymous) with fighting games that regularly use a long chains of button inputs to skilltest the most powerful attacks. Less stringent combos are also found in other games that have some sort of skill mastery and combat component. Finally, combos are occasionally useful for triggering cheat codes.

Input offers a compact but powerful API to manage combos, including charge moves and directionality. This page will describe how to set up the combo system. Getter functions specifically associated with combos can be found [here](Functions-(Combo-Getters)).

&nbsp;

## …combo_params_set_side_on

`input_combo_params_set_side_on(forwardVerb, backwardVerb, referenceDirection)`

<!-- tabs:start -->

#### **Description**

**Returns:** N/A (`undefined`)

|Name |Datatype|Purpose |
|--------------------|--------|-------------------------------------------------|
|`forwardVerb` |verb |Verb to use to indicate the forward direction |
|`backwardVerb` |verb |Verb to use to indicate the backward direction |
|`referenceDirection`|number |Game world angle to use for the forward direction|

#### **Example**

```gml
//Set up combos such that "left" is considered the "forward" direction
//To correctly line up results from input_combo_get_direction() with the game world, use 180 as the reference direction
input_combo_params_set_side_on("left", "right", 180);
```
<!-- tabs:end -->
&nbsp;
## …combo_params_set_top_down
`input_combo_params_set_top_down(forwardVerb, counterclockwiseVerb, backwardVerb, clockwiseVerb, referenceDirection)`
<!-- tabs:start -->
#### **Description**
**Returns:** N/A (`undefined`)
|Name |Datatype|Purpose |
|----------------------|--------|--------------------------------------------------------|
|`forwardVerb` |verb |Verb to use to indicate the forward direction |
|`counterclockwiseVerb`|verb |Verb to use to indicate the counter-clockwise direction |
|`backwardVerb` |verb |Verb to use to indicate the backward direction |
|`clockwiseVerb` |verb |Verb to use to indicate the clockwise direction |
|`referenceDirection` |number |Game world angle to use for the forward direction |
?>
#### **Example**
```gml
//Set up combos to interpret the right-hand direction as "forwards"
input_combo_params_set_top_down("right", "up", "left", "down", 0);
```

<!-- tabs:end -->

&nbsp;

## …combo_params_get

`input_combo_params_get()`

<!-- tabs:start -->

#### **Description**

**Returns:** Struct, see below

|Name|Datatype|Purpose|
|----|--------|-------|
|None| | |

Returns the current combo parameters as a struct. The struct contains the following member variables:

|Variable |Datatype|Purpose |
|-----------------------|--------|-------------------------------------------------------------------------|
|`reset` |boolean |Whether the combo parameters have been reset i.e. blank/invalid |
|`side_on` |boolean |Whether the side-on mode (`true`) or top-down mode (`false`) has been set|
|`forward_verb` |verb |Name of the verb for the forward direction |
|`counterclockwise_verb`|verb |Name of the verb for the counter-clockwise direction, if applicable |
|`backward_verb` |verb |Name of the verb for the forward direction |
|`clockwise_verb` |verb |Name of the verb for the clockwise direction, if applicable |
|`reference_direction` |number |Reference angle for the forward direction |

<!-- tabs:end -->

&nbsp;

## …combo_params_reset

`input_combo_params_reset()`

<!-- tabs:start -->

#### **Description**

**Returns:** N/A (`undefined`)

|Name|Datatype|Purpose|
|----|--------|-------|
|None| | |

Resets combo parameters entirely. This will force all combos defined as "directional" to be evaluated non-directional until `input_combo_params_set_side_on()` or `input_combo_params_set_top_down()` are called.

Honestly, I'm not sure what the use case is for this function is but it exists if you need it.

<!-- tabs:end -->
3 changes: 0 additions & 3 deletions docs/6.1/Functions-(Combos).md

This file was deleted.

5 changes: 3 additions & 2 deletions docs/6.1/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
- [2D Checkers](Functions-(2D-Checkers))
- [Advanced Checkers](Functions-(Advanced-Checkers))
- [Further Verb Functions](Functions-(Further-Verbs))
- [Creating Combos](Functions-(Creating-Combos))
- [Combos](Functions-(Combos))
- [Combo Parameters](Functions-(Combo-Parameters))
- [Combo Creation](Functions-(Combo-Creation))
- [Combo Getters](Functions-(Combo-Getters))
- [Binding Creators](Functions-(Binding-Creators))
- [Binding Access](Functions-(Binding-Access))
- [Binding Scanner](Functions-(Binding-Scan))
Expand Down

0 comments on commit 406cc95

Please sign in to comment.