By George — February 11, 2018
Returns the current “CPU Action” setting in training mode. Can be used in ai_update.gml to separate attack code from other code (like recovery code).
▼ Return values:
CPU_STAND
CPU_CROUCH
CPU_JUMP
CPU_RUN
CPU_PARRY
CPU_ROLL
CPU_FIGHT
CPU_EVADE
When not in training mode, the function will always return CPU_FIGHT.
Example, called from ai_update.gml:
if (get_training_cpu_action() == CPU_FIGHT) {
}
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
Returns the ID of the player associated with the object. Used for referencing objects that you normally don’t have access to.
Argument | Type | Description |
---|
instance_id | :real | The ID of the instance to get the player ID of |
Example, called from hit_player.gml:
with (asset_get( "plant_obj" )) {
if (get_instance_player_id( self ) == other.hit_player_obj) {
sound_play( "plant_concerned_sound" );
}
}
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
Returns the player number of the specified instance. Used for referencing objects that you normally don’t have access to.
Argument | Type | Description |
---|
instance_id | :real | The ID of the instance to get the player number of |
Example, called from article1_update.gml:
with (asset_get( "plasma_field_obj" )) {
with (other.id) {
var _team = get_player_team( get_instance_player( other ));
if (_team != get_player_team( player )
&& point_distance(
x + 10 * spr_dir,
y,
get_instance_x( other ),
get_instance_y( other )
) < 180) {
instance_destroy();
}
}
}
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
Returns the y value of the specified instance. Used for referencing objects that you normally don’t have access to.
Argument | Type | Description |
---|
instance_id | :real | The ID of the instance to get the y value of |
Example, called from article1_update.gml:
with (asset_get( "plasma_field_obj" )) {
with (other.id) {
if (point_distance(
x + 10 * spr_dir,
y,
get_instance_x( other ),
get_instance_y( other )
) < 180) {
instance_destroy();
}
}
}
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
Returns the x value of the specified instance. Used for referencing objects that you normally don’t have access to.
Argument | Type | Description |
---|
instance_id | :real | The ID of the instance to get the x value of |
Example, called from article1_update.gml:
with (asset_get( "plasma_field_obj" )) {
with (other.id) {
if (point_distance(
x + 10 * spr_dir,
y,
get_instance_x( other ),
get_instance_y( other )
) < 180) {
instance_destroy();
}
}
}
Categories: Functions, Programming, Workshop | Comments: 0