From 4d394955faf549cfd935f8f8ade14534c5976317 Mon Sep 17 00:00:00 2001 From: the me Date: Tue, 16 Aug 2022 15:28:01 -0700 Subject: [PATCH 1/2] move you self --- eastern flames/eastern flames.yyp | 2 ++ .../objects/ARTICULATOR/ARTICULATOR.yy | 2 +- .../objects/ARTICULATOR/Create_0.gml | 11 ++++++---- eastern flames/objects/ARTICULATOR/Draw_0.gml | 0 .../objects/ARTICULATOR/Draw_64.gml | 21 +++++++++++++++++++ eastern flames/objects/ARTICULATOR/Step_0.gml | 13 +++++++++++- eastern flames/objects/o_unit/Create_0.gml | 11 ++++++++-- eastern flames/objects/o_unit/Draw_0.gml | 1 + .../scripts/c_getstats/c_getstats.gml | 15 +++++++++++++ .../scripts/c_getstats/c_getstats.yy | 12 +++++++++++ .../scripts/c_moveunit/c_moveunit.gml | 6 ++++++ .../scripts/c_moveunit/c_moveunit.yy | 12 +++++++++++ .../scripts/c_selectunit/c_selectunit.gml | 4 +++- .../scripts/st_moving/st_moving.gml | 11 +++++++--- eastern flames/scripts/stat/stat.gml | 4 +++- eastern flames/scripts/tiledata/tiledata.gml | 15 ++++++++----- eastern flames/scripts/unit/unit.gml | 4 ++-- eastern flames/scripts/weapon/weapon.gml | 5 +++-- 18 files changed, 127 insertions(+), 22 deletions(-) delete mode 100644 eastern flames/objects/ARTICULATOR/Draw_0.gml create mode 100644 eastern flames/objects/ARTICULATOR/Draw_64.gml create mode 100644 eastern flames/scripts/c_getstats/c_getstats.gml create mode 100644 eastern flames/scripts/c_getstats/c_getstats.yy create mode 100644 eastern flames/scripts/c_moveunit/c_moveunit.gml create mode 100644 eastern flames/scripts/c_moveunit/c_moveunit.yy diff --git a/eastern flames/eastern flames.yyp b/eastern flames/eastern flames.yyp index 37f66f6..354e2c5 100644 --- a/eastern flames/eastern flames.yyp +++ b/eastern flames/eastern flames.yyp @@ -6,6 +6,7 @@ {"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,}, + {"id":{"name":"c_getstats","path":"scripts/c_getstats/c_getstats.yy",},"order":16,}, {"id":{"name":"stat","path":"scripts/stat/stat.yy",},"order":3,}, {"id":{"name":"vlambeer","path":"scripts/vlambeer/vlambeer.yy",},"order":1,}, {"id":{"name":"x_unitsetup","path":"scripts/x_unitsetup/x_unitsetup.yy",},"order":0,}, @@ -63,6 +64,7 @@ {"id":{"name":"c_input","path":"scripts/c_input/c_input.yy",},"order":8,}, {"id":{"name":"st_standing","path":"scripts/st_standing/st_standing.yy",},"order":6,}, {"id":{"name":"unit","path":"scripts/unit/unit.yy",},"order":2,}, + {"id":{"name":"c_moveunit","path":"scripts/c_moveunit/c_moveunit.yy",},"order":17,}, {"id":{"name":"se_play","path":"scripts/se_play/se_play.yy",},"order":5,}, {"id":{"name":"msglang","path":"scripts/msglang/msglang.yy",},"order":15,}, {"id":{"name":"array_front","path":"scripts/array_front/array_front.yy",},"order":2,}, diff --git a/eastern flames/objects/ARTICULATOR/ARTICULATOR.yy b/eastern flames/objects/ARTICULATOR/ARTICULATOR.yy index 20cef4a..79f59ad 100644 --- a/eastern flames/objects/ARTICULATOR/ARTICULATOR.yy +++ b/eastern flames/objects/ARTICULATOR/ARTICULATOR.yy @@ -18,7 +18,7 @@ "physicsKinematic": false, "physicsShapePoints": [], "eventList": [ - {"isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, + {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":72,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, diff --git a/eastern flames/objects/ARTICULATOR/Create_0.gml b/eastern flames/objects/ARTICULATOR/Create_0.gml index b518530..1252166 100644 --- a/eastern flames/objects/ARTICULATOR/Create_0.gml +++ b/eastern flames/objects/ARTICULATOR/Create_0.gml @@ -3,7 +3,10 @@ var i; /*for (i=0; i global.gw-100 { + var guyhits = floor(abs(mouse_y-global.gh-10)/32); + log(guyhits, array_length(selectedunit.inventory)); + if guyhits < array_length(selectedunit.inventory) { + //log("doing"); + selectedunit.equippedweapon = guyhits+1; + c_equipweapon(selectedunit, selectedunit.inventory[selectedunit.equippedweapon]); + } + //draw_text(global.gw-10, global.gh-10-i*20; + } } \ No newline at end of file diff --git a/eastern flames/objects/o_unit/Create_0.gml b/eastern flames/objects/o_unit/Create_0.gml index cdb7b21..f122211 100644 --- a/eastern flames/objects/o_unit/Create_0.gml +++ b/eastern flames/objects/o_unit/Create_0.gml @@ -11,6 +11,7 @@ attacked = 0; inventory = []; c_addweapon(id, wp.nothing); equippedweapon = noone; +waiting = false; continuecombat = function(me, them) { //if stamina returnable = true stamina-- return true @@ -23,8 +24,14 @@ continuecombat = function(me, them) { action = { effect: function(me, them) { - them.data.hp.val -= me.data.str.val; - return me.data.str.val; + if irandom(99) < (me.data.hit.val) { //add avo + them.data.hp.val -= me.data.str.val; + return me.data.str.val; + } else { + log(string(me) + " missed!"); + return 0; + + } } //animation: new actionanim() diff --git a/eastern flames/objects/o_unit/Draw_0.gml b/eastern flames/objects/o_unit/Draw_0.gml index 61afeff..3e4e439 100644 --- a/eastern flames/objects/o_unit/Draw_0.gml +++ b/eastern flames/objects/o_unit/Draw_0.gml @@ -1,3 +1,4 @@ +if waiting image_blend = c_grey else image_blend = c_white; draw_self(); drawstate(); //log(data); diff --git a/eastern flames/scripts/c_getstats/c_getstats.gml b/eastern flames/scripts/c_getstats/c_getstats.gml new file mode 100644 index 0000000..c5e2565 --- /dev/null +++ b/eastern flames/scripts/c_getstats/c_getstats.gml @@ -0,0 +1,15 @@ +function c_getstats(target) { + var dudes = variable_struct_get_names(target.data); + var lads = variable_struct_get_names(st); + var chaps = []; + var i; + for (i=0; i= array_length(dudes) break; + } + if i >= array_length(dudes) break; + array_push(chaps, target.data[$dudes[i]]); + } + return chaps; +} \ No newline at end of file diff --git a/eastern flames/scripts/c_getstats/c_getstats.yy b/eastern flames/scripts/c_getstats/c_getstats.yy new file mode 100644 index 0000000..aced597 --- /dev/null +++ b/eastern flames/scripts/c_getstats/c_getstats.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "Scripts", + "path": "folders/Scripts.yy", + }, + "resourceVersion": "1.0", + "name": "c_getstats", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/eastern flames/scripts/c_moveunit/c_moveunit.gml b/eastern flames/scripts/c_moveunit/c_moveunit.gml new file mode 100644 index 0000000..3547b8b --- /dev/null +++ b/eastern flames/scripts/c_moveunit/c_moveunit.gml @@ -0,0 +1,6 @@ +function c_moveunit(targetunit, destination) { + array_remove(c_gettile(targetunit.pos.x, targetunit.pos.y).contents, targetunit); + array_push(destination.contents, targetunit); + targetunit.pos.x = destination.x; + targetunit.pos.y = destination.y; +} \ No newline at end of file diff --git a/eastern flames/scripts/c_moveunit/c_moveunit.yy b/eastern flames/scripts/c_moveunit/c_moveunit.yy new file mode 100644 index 0000000..affe33a --- /dev/null +++ b/eastern flames/scripts/c_moveunit/c_moveunit.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "Scripts", + "path": "folders/Scripts.yy", + }, + "resourceVersion": "1.0", + "name": "c_moveunit", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/eastern flames/scripts/c_selectunit/c_selectunit.gml b/eastern flames/scripts/c_selectunit/c_selectunit.gml index f10f270..7fa162a 100644 --- a/eastern flames/scripts/c_selectunit/c_selectunit.gml +++ b/eastern flames/scripts/c_selectunit/c_selectunit.gml @@ -1,8 +1,9 @@ function c_selectunit(unitobject) { + if unitobject.waiting return false unitobject.state = st_moving; unitobject.drawstate = st_movingdraw; unitobject.returnpos = new vec2(unitobject.pos.x, unitobject.pos.y); - var mov = 2//DONT + var mov = unitobject.data.mov.val; var i, j; for (i=-mov; i<=mov; i++) { for (j=-mov; j<=mov; j++) { @@ -12,6 +13,7 @@ function c_selectunit(unitobject) { } } ARTICULATOR.selectedunit = unitobject; + return unitobject; } function c_deselectunit(unitobject) { diff --git a/eastern flames/scripts/st_moving/st_moving.gml b/eastern flames/scripts/st_moving/st_moving.gml index f078d48..726d650 100644 --- a/eastern flames/scripts/st_moving/st_moving.gml +++ b/eastern flames/scripts/st_moving/st_moving.gml @@ -1,9 +1,9 @@ function st_moving() { - var mov = 2; + var mov = data.mov.val; c_input(); hspd = lerp(hspd, (right-left)*.05, .4); vspd = lerp(vspd, (down-up)*.05, .4); - //if !stop dir = DIR.NONE; + if !stop dir = DIR.NONE; if left dir = DIR.LEFT; if down dir = DIR.DOWN; if up dir = DIR.UP; @@ -47,7 +47,7 @@ function st_moving() { //var rng = [1]; var guy = c_gettile(x, y, true); var hitting = noone; - if guy != noone { + if guy != noone && stop { switch dir { case DIR.LEFT: hitting = c_gettile(guy.x-1, guy.y); @@ -96,6 +96,11 @@ function st_moving() { if back { c_deselectunit(id); } + if dir == DIR.NONE && select { + c_moveunit(id, c_gettile(x, y, true)); + waiting = true; + c_deselectunit(id); + } /*if x < (pos.x-mov)*ts.x { x = (pos.x-mov)*ts.x; } else if x > (pos.x+mov+1)*ts.x { diff --git a/eastern flames/scripts/stat/stat.gml b/eastern flames/scripts/stat/stat.gml index 915f166..6d8cb8a 100644 --- a/eastern flames/scripts/stat/stat.gml +++ b/eastern flames/scripts/stat/stat.gml @@ -44,4 +44,6 @@ function modulo(val1, val2) { nu stat("hp", "health", "vitality"); nu stat("str", "strength", "physical power"); nu stat("def", "defense", "physical defense"); -nu stat("spd", "speed", "avoid and follow-up"); \ No newline at end of file +nu stat("spd", "speed", "avoid and follow-up"); +nu stat("hit", "hit rate", "chance to hit"); +nu stat("mov", "movement", "distance travelable"); \ No newline at end of file diff --git a/eastern flames/scripts/tiledata/tiledata.gml b/eastern flames/scripts/tiledata/tiledata.gml index d8ecfd4..7bd2efd 100644 --- a/eastern flames/scripts/tiledata/tiledata.gml +++ b/eastern flames/scripts/tiledata/tiledata.gml @@ -7,7 +7,7 @@ global.map = [ [new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], [new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], [new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], -[new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], +[new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(u, u, [c_lime], [new statmod(st.def, 5, add)]), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], [new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], [new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], [new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()], @@ -26,8 +26,13 @@ function c_informtiles() { c_informtiles(); global.tilesize = new vec2(32, 32); -function tiledata(passable_=true) constructor { - passable = passable; - contents = []; - overlays = []; +function tiledata(passable_=true, contents_=[], overlays_=[], statmods=[]) constructor { + passable = passable_; + contents = contents_; + overlays = overlays_; + modifiers = {}; + var i; + for (i=0; i Date: Tue, 16 Aug 2022 15:39:22 -0700 Subject: [PATCH 2/2] wtf it works --- eastern flames/eastern flames.yyp | 1 + eastern flames/objects/ARTICULATOR/Create_0.gml | 8 +++++--- eastern flames/objects/ARTICULATOR/Draw_64.gml | 10 +++++----- eastern flames/objects/ARTICULATOR/Step_0.gml | 15 +++++++++++++++ eastern flames/scripts/c_fulleval/c_fulleval.gml | 5 +++++ eastern flames/scripts/c_fulleval/c_fulleval.yy | 12 ++++++++++++ eastern flames/scripts/c_moveunit/c_moveunit.gml | 1 + .../scripts/c_selectunit/c_selectunit.gml | 2 ++ eastern flames/scripts/weapon/weapon.gml | 8 ++------ 9 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 eastern flames/scripts/c_fulleval/c_fulleval.gml create mode 100644 eastern flames/scripts/c_fulleval/c_fulleval.yy diff --git a/eastern flames/eastern flames.yyp b/eastern flames/eastern flames.yyp index 354e2c5..e7ece53 100644 --- a/eastern flames/eastern flames.yyp +++ b/eastern flames/eastern flames.yyp @@ -51,6 +51,7 @@ {"id":{"name":"song","path":"scripts/song/song.yy",},"order":1,}, {"id":{"name":"cpp","path":"scripts/cpp/cpp.yy",},"order":1,}, {"id":{"name":"log","path":"scripts/log/log.yy",},"order":10,}, + {"id":{"name":"c_fulleval","path":"scripts/c_fulleval/c_fulleval.yy",},"order":18,}, {"id":{"name":"keyboard_check_advanced","path":"scripts/keyboard_check_advanced/keyboard_check_advanced.yy",},"order":8,}, {"id":{"name":"collision_line_width","path":"scripts/collision_line_width/collision_line_width.yy",},"order":9,}, {"id":{"name":"draw_rectangle_width","path":"scripts/draw_rectangle_width/draw_rectangle_width.yy",},"order":7,}, diff --git a/eastern flames/objects/ARTICULATOR/Create_0.gml b/eastern flames/objects/ARTICULATOR/Create_0.gml index 1252166..6353d5c 100644 --- a/eastern flames/objects/ARTICULATOR/Create_0.gml +++ b/eastern flames/objects/ARTICULATOR/Create_0.gml @@ -4,9 +4,11 @@ var i; c_inheritunit(2+i, 2, un.chara); }*/ var chara = c_inheritunit(8, 5, un.chara); -c_addweapon(chara, wp.knife, false); -c_addweapon(chara, wp[$"iron sword"], true); -c_inheritunit(10, 5, un.kris); +c_addweapon(chara, wp.knife, true); +c_addweapon(chara, wp[$"iron sword"]); +var kris = c_inheritunit(10, 5, un.kris); +c_addweapon(kris, wp[$"iron sword"], true); selectedunit = noone; +hoveredunit = noone; global.gw = 640; global.gh = 360; \ No newline at end of file diff --git a/eastern flames/objects/ARTICULATOR/Draw_64.gml b/eastern flames/objects/ARTICULATOR/Draw_64.gml index 68c37d0..c6498b9 100644 --- a/eastern flames/objects/ARTICULATOR/Draw_64.gml +++ b/eastern flames/objects/ARTICULATOR/Draw_64.gml @@ -1,15 +1,15 @@ -if selectedunit != noone { +if hoveredunit != noone { draw_set_color(c_black); - draw_rectangle(global.gw, global.gh, global.gw-100, global.gh-(array_length(selectedunit.inventory)-1)*32-16, false); + draw_rectangle(global.gw, global.gh, global.gw-100, global.gh-(array_length(hoveredunit.inventory)-1)*32-16, false); draw_set_color(c_white); var i; draw_set_halign(fa_right); - for (i=1; i