Skip to content

Instantly share code, notes, and snippets.

@teukstrid
Created May 24, 2018 07:42
Show Gist options
  • Save teukstrid/3e076ee5a31d578dd3a75951f8a050ae to your computer and use it in GitHub Desktop.
Save teukstrid/3e076ee5a31d578dd3a75951f8a050ae to your computer and use it in GitHub Desktop.
hornet_attack_state
/// @description Attack State
if !instance_exists(o_player) {
state_ = hornet.move;
exit;
}
add_friction_to_movement_entity();
move_movement_entity(true);
if speed_ == 0 {
alarm[2] = global.one_second * random_range(2, 4);
var _direction = point_direction(x, y, o_player.x, o_player.y) + random_range(-30, 30);
var _stinger = instance_create_layer(x, y, "Instances", o_stinger);
_stinger.direction = _direction;
_stinger.image_angle = _direction;
_stinger.speed = 2;
state_ = hornet.move;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment