From 57d7cad71f8cb125724f4ad6c3e4172bc2fd6061 Mon Sep 17 00:00:00 2001 From: Alejandro Akbal <37181533+VoidlessSeven7@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:04:22 +0200 Subject: [PATCH] Added kill --- src/Commands/Player/KillDroids.gml | 22 ++++++++++++++++++++++ src/Main.gml | 10 ++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/Commands/Player/KillDroids.gml diff --git a/src/Commands/Player/KillDroids.gml b/src/Commands/Player/KillDroids.gml new file mode 100644 index 0000000..eab3da7 --- /dev/null +++ b/src/Commands/Player/KillDroids.gml @@ -0,0 +1,22 @@ +#define KillAllDroidsCommand + CommandCreate("killAllDroids", 0, ScriptWrap(KillAllDroids)); + +#define KillAllDroids() +/// @desc Kills all droids + + if (!InGame()) return Trace(global.notInGameMessage) + + // Droid variables + var totalDroids = ItemCount(Item.Droid) + var activeDroids = instance_number(objDroid) + + // Debug droid data + Trace("Total Droid count: " + string(totalDroids)); + Trace("Active Droid count: " + string(activeDroids)); + + // Drones respawn on reload + instance_destroy(objDroid) + + // Message + Trace("Killed " + string(activeDroids) + " Droids"); + \ No newline at end of file diff --git a/src/Main.gml b/src/Main.gml index 209c088..f5dbe76 100644 --- a/src/Main.gml +++ b/src/Main.gml @@ -1,11 +1,13 @@ #define Main // Global -globalMessages() +globalMessages(); // Player -GiveItemCommand() +GiveItemCommand(); -SetXPCommand() +SetXPCommand(); -SetLevelCommand() \ No newline at end of file +SetLevelCommand(); + +KillAllDroidsCommand();