This commit is contained in:
Thomasjnliu 2022-08-16 19:03:14 -04:00
commit 52643c2469
20 changed files with 166 additions and 27 deletions

View File

@ -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,},
@ -50,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,},
@ -63,6 +65,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,},

View File

@ -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",},

View File

@ -3,7 +3,12 @@ var i;
/*for (i=0; i<array_length(global.units[ARMY.US]); i++) {
c_inheritunit(2+i, 2, un.chara);
}*/
var chara = c_inheritunit(2, 2, un.chara);
var chara = c_inheritunit(8, 5, un.chara);
c_addweapon(chara, wp.knife, true);
c_inheritunit(3, 2, un.kris);
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;

View File

@ -0,0 +1,21 @@
if hoveredunit != noone {
draw_set_color(c_black);
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<array_length(hoveredunit.inventory); i++) {
draw_text(global.gw-10, global.gh-10-i*20, (hoveredunit.equippedweapon == i ? "X " : " ") + hoveredunit.inventory[i].name);
}
draw_set_halign(fa_left);
var dudes = c_getstats(hoveredunit);
draw_set_color(c_black);
draw_rectangle(0, 0, 100, (array_length(dudes)-1)*32+16, false);
draw_set_color(c_white);
var i;
for (i=0; i<array_length(dudes); i++) {
draw_text(10, 10+i*20, dudes[i].name + ": " + string(dudes[i].val));
}
draw_set_halign(fa_left);
}

View File

@ -1,5 +1,5 @@
c_input();
if select && selectedunit == noone {
if select && selectedunit == noone {
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
log(mousex, mousey);
@ -14,4 +14,30 @@ if select && selectedunit == noone {
}
}
}
} else if select {
if mouse_x > 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;
}
}
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
//log(mousex, mousey);
hoveredunit = selectedunit;
if mousex < array_length(global.map) {
if mousey < array_length(global.map[mousex]) {
var i;
for (i=0; i<array_length(global.map[mousex][mousey].contents); i++) {
if global.map[mousex][mousey].contents[i].object_index == o_unit {
hoveredunit = (global.map[mousex][mousey].contents[i]);
}
}
}
}

View File

@ -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()

View File

@ -1,3 +1,4 @@
if waiting image_blend = c_grey else image_blend = c_white;
draw_self();
drawstate();
//log(data);

View File

@ -0,0 +1,5 @@
function c_fulleval(target) {
c_modifierreset(target);
c_modeval(target, target.inventory[target.equippedweapon]);
c_modeval(target, c_gettile(target.pos.x, target.pos.y));
}

View File

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

View File

@ -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); i++) {
while !array_contains(lads, dudes[i]) || dudes[i] == "hp" {
array_delete(dudes, i, 1);
if i >= array_length(dudes) break;
}
if i >= array_length(dudes) break;
array_push(chaps, target.data[$dudes[i]]);
}
return chaps;
}

View File

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

View File

@ -0,0 +1,7 @@
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;
}

View File

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

View File

@ -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,8 @@ function c_selectunit(unitobject) {
}
}
ARTICULATOR.selectedunit = unitobject;
c_fulleval(unitobject);
return unitobject;
}
function c_deselectunit(unitobject) {
@ -23,6 +26,7 @@ function c_deselectunit(unitobject) {
c_decolor_all(c_red);
c_decolor_all(c_green);
ARTICULATOR.selectedunit = noone;
c_fulleval(unitobject);
return true;
}

View File

@ -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 {

View File

@ -45,3 +45,5 @@ 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");
nu stat("hit", "hit rate", "chance to hit");
nu stat("mov", "movement", "distance travelable");

View File

@ -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<array_length(statmods); i++) {
modifiers[$statmods[i].name] = statmods[i];
}
}

View File

@ -29,7 +29,7 @@ function unit(personaldata_, classdata_, stats_) constructor {
global.unitdata[$name] = self;
}
nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(20), st.spd.add(5)]);
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)]);
mydata = {
name: "kris",
@ -39,7 +39,7 @@ mydata = {
up: s_guy2,
down: s_guy2,
}
nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(20), st.spd.add(5)]);
nu unit(mydata, mydata, [st.hp.add(110), st.str.add(20), st.def.add(10), st.spd.add(5), st.mov.add(6), st.hit.add(0)]);
function archetypedata() constructor {
//PERSONALDATA AND CLASSDATA ARE THE SAME THINGS

View File

@ -3,8 +3,8 @@ global.weapons = {};
function weapon(name_, description_, type_, statmods=[]) constructor {
name = name_;
description = description_;
modifiers = {};
type = WPTYPE.SWORD;
modifiers = {};
var i;
for (i=0; i<array_length(statmods); i++) {
modifiers[$statmods[i].name] = statmods[i];
@ -29,14 +29,11 @@ function c_addweapon(target, weapon_, equip=false) {
}
function c_equipweapon(target, weapon_) {
log(target.data.str.val);
c_modifierreset(target);
log(target.data.str.val);
c_wpeval(target, weapon_);
log(target.data.str.val);
c_fulleval(target);
}
nu weapon("nothing", "it's literally nothing", WPTYPE.NULL);
nu weapon("knife", "bleed, bleed", WPTYPE.SWORD, [new statmod(st.str, 20, add)]);
nu weapon("knife", "bleed, bleed", WPTYPE.SWORD, [new statmod(st.str, 20, add), new statmod(st.hit, 100, add)]);
nu weapon("iron sword", "made of a cringe material", WPTYPE.SWORD, [new statmod(st.str, 6, add), new statmod(st.hit, 90, add)]);
function c_modifierreset(target) {
var dudes = variable_struct_get_names(target.data);
@ -52,7 +49,7 @@ function c_modifierreset(target) {
}
}
function c_wpeval(target, weapon_) {
function c_modeval(target, weapon_) {
var lads = variable_struct_get_names(target.data);
var dudes = variable_struct_get_names(weapon_.modifiers);
var i;