This commit is contained in:
the me 2022-08-15 18:01:09 -07:00
parent 0ead044da1
commit 51cc3f3ca6
20 changed files with 278 additions and 33 deletions

View File

@ -25,6 +25,7 @@
{"id":{"name":"draw_settings","path":"scripts/draw_settings/draw_settings.yy",},"order":3,},
{"id":{"name":"draw_circle_curve","path":"scripts/draw_circle_curve/draw_circle_curve.yy",},"order":2,},
{"id":{"name":"o_unit","path":"objects/o_unit/o_unit.yy",},"order":2,},
{"id":{"name":"combat","path":"scripts/combat/combat.yy",},"order":13,},
{"id":{"name":"mod_negative","path":"scripts/mod_negative/mod_negative.yy",},"order":11,},
{"id":{"name":"draw_circle_width","path":"scripts/draw_circle_width/draw_circle_width.yy",},"order":3,},
{"id":{"name":"gcd","path":"scripts/gcd/gcd.yy",},"order":5,},
@ -50,6 +51,7 @@
{"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,},
{"id":{"name":"s_guy2","path":"sprites/s_guy2/s_guy2.yy",},"order":1,},
{"id":{"name":"s_momiji","path":"sprites/s_momiji/s_momiji.yy",},"order":0,},
{"id":{"name":"dir2hv","path":"scripts/dir2hv/dir2hv.yy",},"order":2,},
{"id":{"name":"tag","path":"scripts/tag/tag.yy",},"order":6,},
{"id":{"name":"instance_create","path":"scripts/instance_create/instance_create.yy",},"order":6,},
@ -68,9 +70,11 @@
{"id":{"name":"draw_outline","path":"scripts/draw_outline/draw_outline.yy",},"order":5,},
{"id":{"name":"distabs","path":"scripts/distabs/distabs.yy",},"order":11,},
{"id":{"name":"nam","path":"scripts/nam/nam.yy",},"order":13,},
{"id":{"name":"c_resetbattlevar","path":"scripts/c_resetbattlevar/c_resetbattlevar.yy",},"order":14,},
{"id":{"name":"array_find_index","path":"scripts/array_find_index/array_find_index.yy",},"order":1,},
{"id":{"name":"array_greatest","path":"scripts/array_greatest/array_greatest.yy",},"order":4,},
{"id":{"name":"c_null","path":"scripts/c_null/c_null.yy",},"order":4,},
{"id":{"name":"array_contains_within","path":"scripts/array_contains_within/array_contains_within.yy",},"order":19,},
{"id":{"name":"st_moving","path":"scripts/st_moving/st_moving.yy",},"order":7,},
{"id":{"name":"Room1","path":"rooms/Room1/Room1.yy",},"order":0,},
],
@ -108,6 +112,7 @@
{"folderPath":"folders/Scripts/util/drawing.yy","order":3,"resourceVersion":"1.0","name":"drawing","tags":[],"resourceType":"GMFolder",},
{"folderPath":"folders/Scripts/util/drawing/vlambeer.yy","order":1,"resourceVersion":"1.0","name":"vlambeer","tags":[],"resourceType":"GMFolder",},
{"folderPath":"folders/Scripts/util.yy","order":1,"resourceVersion":"1.0","name":"util","tags":[],"resourceType":"GMFolder",},
{"folderPath":"folders/Sprites/momiji.yy","order":2,"resourceVersion":"1.0","name":"momiji","tags":[],"resourceType":"GMFolder",},
],
"AudioGroups": [
{"targets":-1,"resourceVersion":"1.3","name":"audiogroup_default","resourceType":"GMAudioGroup",},

View File

@ -3,3 +3,4 @@ var i;
for (i=0; i<array_length(global.units[ARMY.US]); i++) {
c_inheritunit(2+i, 2, un.chara);
}
selectedunit = noone;

View File

@ -1,5 +1,5 @@
c_input();
if select {
if select && selectedunit == noone {
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
log(mousex, mousey);

View File

@ -6,3 +6,24 @@ hspd = 0;
vspd = 0;
returnpos = new vec2(0, 0);
dir = DIR.NONE;
attacks = 0;
attacked = 0;
continuecombat = function(me, them) {
//if stamina returnable = true stamina-- return true
if !(attacks-(me.data.spd.val > them.data.spd.val+5)) { //DONT USE FIVE, OR ANY OF THIS
attacks++;
return true;
}
return false;
}
action = {
effect: function(me, them) {
them.data.hp.val -= me.data.str.val;
return me.data.str.val;
}
//animation: new actionanim()
}
hooks = {};

View File

@ -1,10 +1,11 @@
draw_self();
drawstate();
log(data);
//log(data);
draw_set_color(c_red);
draw_rectangle(x-ts.x/2, y-ts.y/2-1,
x-ts.x/2+(ts.x*(data.hp.val/data.hp.val)),
x-ts.x/2+(ts.x*(data.hp.val/data.hp.cap)),
y-ts.y/2+1, false
);
draw_text(x, y-ts.y, data.hp.val);
//draw_set_color(c_red);
//draw_circle(x, y, 5, false);

View File

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

View File

@ -0,0 +1,12 @@
function array_contains_within(array, val) {
var i, j;
for (i=0; i<array_length(array); i++) {
if typeof(array[i]) == "struct" {
var dudes = variable_struct_get_names(array[i]);
for (j=0; j<array_length(dudes); j++) {
if array[i][$dudes[j]] == val return true;
}
}
}
return false;
}

View File

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

View File

@ -1,6 +1,11 @@
function c_gettile(x, y, absolute=false) {
if absolute {
var thex = round((x-16)/ts.x);
var they = round((y-16)/ts.y);
} else {
var thex = x;
var they = y;
}
if c_tileexists(thex, they) return mp[thex][they];
return noone;
}

View File

@ -0,0 +1,6 @@
function c_resetbattlevar(target=id) {
with target {
attacks = 0;
attacked = 0;
}
}

View File

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

View File

@ -11,6 +11,18 @@ function c_selectunit(unitobject) {
}
}
}
ARTICULATOR.selectedunit = unitobject;
}
function c_deselectunit(unitobject) {
if ARTICULATOR.selectedunit != unitobject return false
state = st_standing;
drawstate = c_null;
c_decolor_all(c_cyan);
c_decolor_all(c_red);
c_decolor_all(c_green);
ARTICULATOR.selectedunit = noone;
return true;
}
function c_colortile(x, y, color) {

View File

@ -0,0 +1,53 @@
function c_generatecombatstack(combatants=[]) {
log(combatants);
//c_doallhook(hooks.precombat);
for (i=0; i<array_length(combatants); i++) {
c_resetbattlevar(combatants[i]);
}
//while combatants != [] {
log("whiling");
var i=0;
for (i=0; i<array_length(combatants); i++) {
//c_dodualhook(combatants[i], preaction);
tryaction(combatants[i], combatants[(i+1)%array_length(combatants)]);
//c_dodualhook(combatants[i], postaction);
}
//}
for (i=0; i<array_length(combatants); i++) {
c_resetbattlevar(combatants[i]);
}
}
function c_recordaction(action) {
log(action);
}
function c_dodualhook(host, hook) {
}
function c_doallhook(hook) {
}
function tryaction(me, them) {
//c_dodualhook(hooks.onstaminacheck);
while me.continuecombat(me, them) {
//action = defaultaction;
//c_dodualhook(hooks.prehit);
c_recordaction(me.action.effect(me, them));
//c_dodualhook(hooks.posthit);
}
}
/*action {
effect: function() {
}
animation: new actionanim()
}*/
function insertaction(action, interruptable) {
}

View File

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

View File

@ -42,48 +42,48 @@ function st_moving() {
c_decolor_all(c_red);
c_decolor_all(c_green);
var guy = c_gettile(x, y, true);
if guy != noone {
c_colortile(guy.x, guy.y, c_green);
switch dir {
case DIR.LEFT:
c_colortile(guy.x-1, guy.y, c_red);
break;
case DIR.DOWN:
c_colortile(guy.x, guy.y+1, c_red);
break;
case DIR.UP:
c_colortile(guy.x, guy.y-1, c_red);
break;
case DIR.RIGHT:
c_colortile(guy.x+1, guy.y, c_red);
break;
}
}
if select {
//log("selecting");
var rng = [1];
var guy = c_gettile(x, y, true);
var hitting = noone;
if guy != noone {
switch dir {
case DIR.LEFT:
hitting = c_gettile(guy.x-1, guy.y);
c_colortile(guy.x-1, guy.y, c_red);
break;
case DIR.DOWN:
hitting = c_gettile(guy.x, guy.y+1);
c_colortile(guy.x, guy.y+1, c_red);
break;
case DIR.UP:
hitting = c_gettile(guy.x, guy.y-1);
c_colortile(guy.x, guy.y-1, c_red);
break;
case DIR.RIGHT:
hitting = c_gettile(guy.x+1, guy.y);
c_colortile(guy.x+1, guy.y, c_red);
break;
}
if hitting != noone {
if hitting != noone && select {
log("found one");
log(hitting.contents, hitting.x, hitting.y);
var i;
for (i=0; i<array_length(hitting.contents); i++) {
if instance_exists(hitting.contents[i]) {
log("is instance");
if hitting.contents[i].object_index = o_unit {
log("is unit");
log("found two");
c_generatecombatstack([id, hitting.contents[i]]);
}
}
}
}
}
if back {
state = st_standing;
drawstate = c_null;
c_deselectunit(id);
}
/*if x < (pos.x-mov)*ts.x {
x = (pos.x-mov)*ts.x;

View File

@ -14,9 +14,11 @@ function stat(name_, fullname_, desc_, replacements_=[]) constructor {
function unitstat(val_, name_, fullname_, desc_, replacements_) : stat(name_, fullname_, desc_, replacements_) constructor {
val = val_;
cap = val_;
modifier = 0;
}
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");

View File

@ -25,7 +25,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)]);
nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(20), st.spd.add(5)]);
mydata = {
name: "kris",
@ -33,7 +33,7 @@ mydata = {
skills: ["SKILLS.LUNA"],
sprite: s_guy2,
}
nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(20)]);
nu unit(mydata, mydata, [st.hp.add(92), st.str.add(20), st.def.add(20), st.spd.add(5)]);
function archetypedata() constructor {
//PERSONALDATA AND CLASSDATA ARE THE SAME THINGS

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

View File

@ -0,0 +1,79 @@
{
"bboxMode": 0,
"collisionKind": 0,
"type": 0,
"origin": 4,
"preMultiplyAlpha": false,
"edgeFiltering": false,
"collisionTolerance": 0,
"swfPrecision": 2.525,
"bbox_left": 0,
"bbox_right": 0,
"bbox_top": 0,
"bbox_bottom": 0,
"HTile": false,
"VTile": false,
"For3D": false,
"width": 32,
"height": 32,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"swatchColours": null,
"gridX": 0,
"gridY": 0,
"frames": [
{"compositeImage":{"FrameId":{"name":"ea35e997-c3b5-4156-9563-4027f6f9645a","path":"sprites/s_momiji/s_momiji.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"ea35e997-c3b5-4156-9563-4027f6f9645a","path":"sprites/s_momiji/s_momiji.yy",},"LayerId":{"name":"722b53dd-20e3-491f-9203-55886718dd68","path":"sprites/s_momiji/s_momiji.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"s_momiji","path":"sprites/s_momiji/s_momiji.yy",},"resourceVersion":"1.0","name":"ea35e997-c3b5-4156-9563-4027f6f9645a","tags":[],"resourceType":"GMSpriteFrame",},
],
"sequence": {
"spriteId": {"name":"s_momiji","path":"sprites/s_momiji/s_momiji.yy",},
"timeUnits": 1,
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"autoRecord": true,
"volume": 1.0,
"length": 1.0,
"events": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore<MessageEventKeyframe>",},
"moments": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore<MomentsEventKeyframe>",},
"tracks": [
{"name":"frames","spriteId":null,"keyframes":{"Keyframes":[
{"id":"72a83b44-0ad0-4608-9c74-df5a743988f0","Key":0.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"ea35e997-c3b5-4156-9563-4027f6f9645a","path":"sprites/s_momiji/s_momiji.yy",},"resourceVersion":"1.0","resourceType":"SpriteFrameKeyframe",},},"resourceVersion":"1.0","resourceType":"Keyframe<SpriteFrameKeyframe>",},
],"resourceVersion":"1.0","resourceType":"KeyframeStore<SpriteFrameKeyframe>",},"trackColour":0,"inheritsTrackColour":true,"builtinName":0,"traits":0,"interpolation":1,"tracks":[],"events":[],"modifiers":[],"isCreationTrack":false,"resourceVersion":"1.0","tags":[],"resourceType":"GMSpriteFramesTrack",},
],
"visibleRange": null,
"lockOrigin": false,
"showBackdrop": true,
"showBackdropImage": false,
"backdropImagePath": "",
"backdropImageOpacity": 0.5,
"backdropWidth": 1366,
"backdropHeight": 768,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"xorigin": 16,
"yorigin": 16,
"eventToFunction": {},
"eventStubScript": null,
"parent": {"name":"s_momiji","path":"sprites/s_momiji/s_momiji.yy",},
"resourceVersion": "1.3",
"name": "s_momiji",
"tags": [],
"resourceType": "GMSequence",
},
"layers": [
{"visible":true,"isLocked":false,"blendMode":0,"opacity":100.0,"displayName":"default","resourceVersion":"1.0","name":"722b53dd-20e3-491f-9203-55886718dd68","tags":[],"resourceType":"GMImageLayer",},
],
"nineSlice": null,
"parent": {
"name": "momiji",
"path": "folders/Sprites/momiji.yy",
},
"resourceVersion": "1.0",
"name": "s_momiji",
"tags": [],
"resourceType": "GMSprite",
}