looks like battle animations to me

This commit is contained in:
the me 2022-08-23 01:34:45 -07:00
parent 64a74d6f36
commit b0e718f879
12 changed files with 107 additions and 20 deletions

View File

@ -126,6 +126,7 @@
{"id":{"name":"c_selectunit","path":"scripts/c_selectunit/c_selectunit.yy",},"order":9,},
{"id":{"name":"array_generate_2d","path":"scripts/array_generate_2d/array_generate_2d.yy",},"order":3,},
{"id":{"name":"c_input","path":"scripts/c_input/c_input.yy",},"order":8,},
{"id":{"name":"o_damage","path":"objects/o_damage/o_damage.yy",},"order":4,},
{"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,},

View File

@ -8,6 +8,7 @@ var i;
c_loadstageone();
waiting = 0;
selectedunit = noone;
hoveredunit = noone;
hspd = 0;

View File

@ -0,0 +1,4 @@
amount = 0;
count = 0;
hspd = 0;
vspd = 0;

View File

@ -0,0 +1,16 @@
cpp();
draw_set_color(c_black);
//draw_set_alpha(0.25);
//draw_circle(x,y,5,false);
//draw_set_alpha(1);
var worldMat = matrix_get(matrix_world);
//this is the location of where i want to draw from !!!
var worldMat2 = matrix_build(x,y+6,0,50,0,0,0.6,0.6,0.6);
matrix_set(matrix_world,worldMat2);
draw_set_halign(fa_center);
draw_text(0, 0, amount);
draw_set_halign(fa_left);
//draw_set_color(c_red);
//draw_circle(x, y, 5, false);
matrix_set(matrix_world,worldMat);

View File

@ -0,0 +1,7 @@
vspd -= .2;
x += hspd;
y += vspd;
if count >= 40 {
image_alpha -= .1;
if !image_alpha instance_destroy();
}

View File

@ -0,0 +1,35 @@
{
"spriteId": null,
"solid": false,
"visible": true,
"spriteMaskId": null,
"persistent": false,
"parentObjectId": null,
"physicsObject": false,
"physicsSensor": false,
"physicsShape": 1,
"physicsGroup": 1,
"physicsDensity": 0.5,
"physicsRestitution": 0.1,
"physicsLinearDamping": 0.1,
"physicsAngularDamping": 0.1,
"physicsFriction": 0.2,
"physicsStartAwake": true,
"physicsKinematic": false,
"physicsShapePoints": [],
"eventList": [
{"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":0,"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",},
],
"properties": [],
"overriddenProperties": [],
"parent": {
"name": "Objects",
"path": "folders/Objects.yy",
},
"resourceVersion": "1.0",
"name": "o_damage",
"tags": [],
"resourceType": "GMObject",
}

View File

@ -28,11 +28,15 @@ continuecombat = function(me, them) {
action = {
effect: function(me, them) {
var guy = instance_create(them.x, them.y, o_damage);
guy.hspd = random(3)-1.5;
guy.vspd = -random(1)-3;
if irandom(99) < (me.data.hit.val) { //add avo
them.data.hp.val -= (me.data.str.val-them.data.def.val);
guy.amount = (me.data.str.val-them.data.def.val);
return me.data.str.val;
} else {
log(string(me) + " missed!");
guy.amount = "Miss!";
return 0;
}

View File

@ -97,6 +97,7 @@ function c_doenemyai(target) {
break;
}
c_loadmarkings();
waiting = 70;
}
function c_findnearestunit(alignment) {

View File

@ -1,7 +1,7 @@
function c_moveunit(targetunit, destination) {
var theguy = c_gettile(targetunit.pos.x, targetunit.pos.y);
log(theguy.contents);
if !array_remove(theguy.contents, targetunit) idhfnjg();
/*if !*/array_remove(theguy.contents, targetunit) //idhfnjg();
array_push(destination.contents, targetunit);
targetunit.pos.x = destination.x;
targetunit.pos.y = destination.y;

View File

@ -73,6 +73,7 @@ function st_control() {
}
c_dewait(global.turn);
//global.turn = (global.turn+1)%2;
k = 0;
global.turn = ARMY.THEM;
log("TURN " + string(global.turn));
state = st_enemyturn;

View File

@ -1,19 +1,36 @@
function st_enemyturn() {
while global.turn == ARMY.THEM {
var done = true;
for (k=0; k<array_length(global.units[ARMY.THEM]); k++) {
var target = global.units[ARMY.THEM][k];
if !target.waiting {
done = false;
} else {
continue;
}
c_doenemyai(target);
}
if done {
c_dewait(global.turn);
state = st_control;
global.turn = ARMY.US;
}
if selectedunit != noone {
hspd = 0;
vspd = 0;
x = lerp(x, selectedunit.x, .4);
y = lerp(y, selectedunit.y, .4);
cursor.x = mouse_x;
cursor.y = mouse_y;
global.camerax = x;
global.cameray = y;
}
if waiting {
waiting--;
exit;
}
done = false;
//for (k=0; k<array_length(global.units[ARMY.THEM]); k++) {
var target = global.units[ARMY.THEM][k];
selectedunit = target;
while !target.waiting {
c_doenemyai(target);
if waiting exit;
}
k++;
if k >= array_length(global.units[ARMY.THEM]){
done = true;
}
//}
if done {
c_dewait(global.turn);
k = 0;
state = st_control;
global.turn = ARMY.US;
}
//}
}

View File

@ -1,5 +1,5 @@
function st_standing() {
x = pos.x*global.tilesize.x+global.tilesize.x/2;
y = pos.y*global.tilesize.y+global.tilesize.y/2;
x = lerp(x, pos.x*global.tilesize.x+global.tilesize.x/2, .1);
y = lerp(y, pos.y*global.tilesize.y+global.tilesize.y/2, .1);
//log(x, y);
}