skill solution

This commit is contained in:
the me 2022-08-18 18:05:37 -07:00
parent e944e0de19
commit 5f9a983cd0
10 changed files with 110 additions and 9 deletions

View File

@ -4,6 +4,7 @@
{"id":{"name":"draw_sprite_at","path":"scripts/draw_sprite_at/draw_sprite_at.yy",},"order":8,}, {"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":"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":"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":"clampneg","path":"scripts/clampneg/clampneg.yy",},"order":8,},
{"id":{"name":"array_remove","path":"scripts/array_remove/array_remove.yy",},"order":6,}, {"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,}, {"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":"bint_sort","path":"scripts/bint_sort/bint_sort.yy",},"order":0,},
{"id":{"name":"vec2","path":"scripts/vec2/vec2.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":"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":"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":"s_bunnydown","path":"sprites/s_bunnydown/s_bunnydown.yy",},"order":2,},
{"id":{"name":"o_flash","path":"objects/o_flash/o_flash.yy",},"order":0,}, {"id":{"name":"o_flash","path":"objects/o_flash/o_flash.yy",},"order":0,},

View File

@ -24,7 +24,7 @@ function getView(){
var _x = global.camerax; var _x = global.camerax;
var _y = global.cameray; var _y = global.cameray;
var half = (7.5*32)+40; 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(){ function setCam(){

View File

@ -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<array_length(global.units[alignment]); i++) {
var guy = global.units[alignment][i].pos;
if (lowest.x + lowest.y < guy.x + guy.y) {
lowest = guy;
lowestunit = global.units[alignment][i];
}
}
return
}

View File

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "Scripts",
"path": "folders/Scripts.yy",
},
"resourceVersion": "1.0",
"name": "c_doenemyai",
"tags": [],
"resourceType": "GMScript",
}

View File

@ -41,6 +41,9 @@ function c_loadstageone() {
bunny = c_inheritunit(18, 7, un.bunny, ARMY.THEM); bunny = c_inheritunit(18, 7, un.bunny, ARMY.THEM);
c_addweapon(bunny, wp[$"iron sword"], true); c_addweapon(bunny, wp[$"iron sword"], true);
bunny = c_inheritunit(19, 13, un.bunny, ARMY.THEM);
c_addweapon(bunny, wp[$"iron sword"], true);
var reisen = c_inheritunit(19, 1, un[$"rei'sen"], true, ARMY.THEM); var reisen = c_inheritunit(19, 1, un[$"rei'sen"], true, ARMY.THEM);
c_addweapon(reisen, wp[$"iron sword"], true); c_addweapon(reisen, wp[$"iron sword"], true);

View File

@ -0,0 +1,3 @@
function c_tiledist(x1, y1, x2, y2) {
return new vec2(abs(x1-y2), abs(y1-y2));
}

View File

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "Scripts",
"path": "folders/Scripts.yy",
},
"resourceVersion": "1.0",
"name": "c_tiledist",
"tags": [],
"resourceType": "GMScript",
}

View File

@ -71,7 +71,7 @@ function st_moving() {
break; break;
default: default:
sprite_index = data.idle; sprite_index = data.idle;
image_xscale = -1; //image_xscale = -1;
break; break;
} }

View File

@ -40,6 +40,15 @@ function divide(val1, val2) {
function modulo(val1, val2) { function modulo(val1, val2) {
return val1 % val2; return val1 % val2;
} }
function set(val1, val2) {
return val2;
}
function andop(val1, val2) {
return val1 & val2;
}
function orop(val1, val2) {
return val1 | val2;
}
nu stat("hp", "health", "vitality"); nu stat("hp", "health", "vitality");
nu stat("str", "strength", "physical power"); nu stat("str", "strength", "physical power");
@ -47,3 +56,4 @@ nu stat("def", "defense", "physical defense");
nu stat("spd", "speed", "avoid and follow-up"); nu stat("spd", "speed", "avoid and follow-up");
nu stat("hit", "hit rate", "chance to hit"); nu stat("hit", "hit rate", "chance to hit");
nu stat("mov", "movement", "distance travelable"); nu stat("mov", "movement", "distance travelable");
nu stat("rng", "range", "distance attackable");

View File

@ -1,4 +1,10 @@
global.unitdata = {}; global.unitdata = {};
enum AI {
AFK,
KILLER,
WAITER,
ESCAPER,
}
var mydata = { var mydata = {
name: "chara", name: "chara",
@ -7,8 +13,9 @@ var mydata = {
idle: s_momiji, idle: s_momiji,
up: s_momijiup, up: s_momijiup,
down: s_momijidown, down: s_momijidown,
aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(10), st.spd.add(5), st.mov.add(4), st.hit.add(0)]); nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(10), st.spd.add(5), st.mov.add(4), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "kris", name: "kris",
@ -17,8 +24,9 @@ mydata = {
idle: s_bunny, idle: s_bunny,
up: s_bunnyup, up: s_bunnyup,
down: s_bunnydown, down: s_bunnydown,
aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(110), st.str.add(20), st.def.add(10), st.spd.add(5), st.mov.add(4), st.hit.add(0)]); nu unit(mydata, mydata, [st.hp.add(110), st.str.add(20), st.def.add(10), st.spd.add(5), st.mov.add(4), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "momiji", name: "momiji",
@ -27,8 +35,9 @@ mydata = {
idle: s_momiji, idle: s_momiji,
up: s_momijiup, up: s_momijiup,
down: s_momijidown, down: s_momijidown,
aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(30), st.str.add(12), st.def.add(8), st.spd.add(10), st.mov.add(4), st.hit.add(0)]); nu unit(mydata, mydata, [st.hp.add(30), st.str.add(12), st.def.add(8), st.spd.add(10), st.mov.add(4), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "nitori", name: "nitori",
desc: "", desc: "",
@ -36,8 +45,9 @@ mydata = {
idle: s_bunny, idle: s_bunny,
up: s_bunnyup, up: s_bunnyup,
down: s_bunnydown, down: s_bunnydown,
aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(34), st.str.add(10), st.def.add(6), st.spd.add(6), st.mov.add(4), st.hit.add(0)]); nu unit(mydata, mydata, [st.hp.add(34), st.str.add(10), st.def.add(6), st.spd.add(6), st.mov.add(4), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "bunny", name: "bunny",
desc: "", desc: "",
@ -45,8 +55,9 @@ mydata = {
idle: s_bunny, idle: s_bunny,
up: s_bunnyup, up: s_bunnyup,
down: s_bunnydown, down: s_bunnydown,
aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(25), st.str.add(9), st.def.add(7), st.spd.add(7), st.mov.add(4), st.hit.add(0)]); nu unit(mydata, mydata, [st.hp.add(25), st.str.add(9), st.def.add(7), st.spd.add(7), st.mov.add(4), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "rei'sen", name: "rei'sen",
desc: "", desc: "",
@ -54,5 +65,6 @@ mydata = {
idle: s_bunny, idle: s_bunny,
up: s_bunnyup, up: s_bunnyup,
down: s_bunnydown, down: s_bunnydown,
aitype: AI.WAITER,
} }
nu unit(mydata, mydata, [st.hp.add(40), st.str.add(14), st.def.add(10), st.spd.add(13), st.mov.add(2), st.hit.add(0)]); nu unit(mydata, mydata, [st.hp.add(40), st.str.add(14), st.def.add(10), st.spd.add(13), st.mov.add(2), st.hit.add(0), st.rng.add(1)]);