From 5f9a983cd0807267e0d7bfc3fb8f9d7234338187 Mon Sep 17 00:00:00 2001 From: the me Date: Thu, 18 Aug 2022 18:05:37 -0700 Subject: [PATCH] skill solution --- eastern flames/eastern flames.yyp | 2 + .../objects/ARTICULATOR/Create_0.gml | 2 +- .../scripts/c_doenemyai/c_doenemyai.gml | 47 +++++++++++++++++++ .../scripts/c_doenemyai/c_doenemyai.yy | 12 +++++ .../scripts/c_loadstageone/c_loadstageone.gml | 3 ++ .../scripts/c_tiledist/c_tiledist.gml | 3 ++ .../scripts/c_tiledist/c_tiledist.yy | 12 +++++ .../scripts/st_moving/st_moving.gml | 2 +- eastern flames/scripts/stat/stat.gml | 12 ++++- eastern flames/scripts/x_units/x_units.gml | 24 +++++++--- 10 files changed, 110 insertions(+), 9 deletions(-) create mode 100644 eastern flames/scripts/c_doenemyai/c_doenemyai.gml create mode 100644 eastern flames/scripts/c_doenemyai/c_doenemyai.yy create mode 100644 eastern flames/scripts/c_tiledist/c_tiledist.gml create mode 100644 eastern flames/scripts/c_tiledist/c_tiledist.yy diff --git a/eastern flames/eastern flames.yyp b/eastern flames/eastern flames.yyp index 01422a1..fbc77f6 100644 --- a/eastern flames/eastern flames.yyp +++ b/eastern flames/eastern flames.yyp @@ -4,6 +4,7 @@ {"id":{"name":"draw_sprite_at","path":"scripts/draw_sprite_at/draw_sprite_at.yy",},"order":8,}, {"id":{"name":"c_inheritunit","path":"scripts/c_inheritunit/c_inheritunit.yy",},"order":5,}, {"id":{"name":"array_sum","path":"scripts/array_sum/array_sum.yy",},"order":7,}, + {"id":{"name":"c_doenemyai","path":"scripts/c_doenemyai/c_doenemyai.yy",},"order":23,}, {"id":{"name":"clampneg","path":"scripts/clampneg/clampneg.yy",},"order":8,}, {"id":{"name":"array_remove","path":"scripts/array_remove/array_remove.yy",},"order":6,}, {"id":{"name":"lerp_angle","path":"scripts/lerp_angle/lerp_angle.yy",},"order":9,}, @@ -19,6 +20,7 @@ {"id":{"name":"bint_sort","path":"scripts/bint_sort/bint_sort.yy",},"order":0,}, {"id":{"name":"vec2","path":"scripts/vec2/vec2.yy",},"order":0,}, {"id":{"name":"array_insert_array","path":"scripts/array_insert_array/array_insert_array.yy",},"order":5,}, + {"id":{"name":"c_tiledist","path":"scripts/c_tiledist/c_tiledist.yy",},"order":24,}, {"id":{"name":"draw_percent","path":"scripts/draw_percent/draw_percent.yy",},"order":6,}, {"id":{"name":"s_bunnydown","path":"sprites/s_bunnydown/s_bunnydown.yy",},"order":2,}, {"id":{"name":"o_flash","path":"objects/o_flash/o_flash.yy",},"order":0,}, diff --git a/eastern flames/objects/ARTICULATOR/Create_0.gml b/eastern flames/objects/ARTICULATOR/Create_0.gml index f31fa65..878bc85 100644 --- a/eastern flames/objects/ARTICULATOR/Create_0.gml +++ b/eastern flames/objects/ARTICULATOR/Create_0.gml @@ -24,7 +24,7 @@ function getView(){ var _x = global.camerax; var _y = global.cameray; var half = (7.5*32)+40; - return matrix_build_lookat(_x,_y+100,100,_x,_y,0,0,0,-1); + return matrix_build_lookat(_x,_y+180,150,_x,_y,0,0,0,-1); } function setCam(){ diff --git a/eastern flames/scripts/c_doenemyai/c_doenemyai.gml b/eastern flames/scripts/c_doenemyai/c_doenemyai.gml new file mode 100644 index 0000000..50672b3 --- /dev/null +++ b/eastern flames/scripts/c_doenemyai/c_doenemyai.gml @@ -0,0 +1,47 @@ +function c_doenemyai(target) { + switch target.data.aitype { + case AI.AFK: + target.waiting = true; + break; + case AI.KILLER: + var dude = c_findnearestunit(ARMY.US); + repeat(target.data.mov.val) { + var guy = c_gettile(target.pos.x, target.pos.y); + if target.pos.x < dude.x { + var guy = c_gettile(target.pos.x+1, target.pos.y); + } else if target.pos.x > dude.x { + var guy = c_gettile(target.pos.x-1, target.pos.y); + } + if target.pos.y < dude.y { + var guy = c_gettile(target.pos.x+1, target.pos.y); + } else if target.pos.x > dude.x { + var guy = c_gettile(target.pos.x-1, target.pos.y); + } + if guy.passable { + c_moveunit(target, guy); + continue; + } + } + target.waiting = true; + break; + case AI.WAITER: + + break; + case AI.ESCAPER: + + break; + } +} + +function c_findnearestunit(alignment) { + var lowest = new vec2(99, 99); + var lowestunit = new vec2(99, 99); + for (i=0; i