eastern-flames/eastern flames/objects/ARTICULATOR/Step_0.gml

88 lines
2.4 KiB
Plaintext
Raw Normal View History

2022-08-19 01:47:44 +00:00
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);
global.turn = (global.turn+1)%2;
}
}
2022-08-15 04:06:41 +00:00
c_input();
2022-08-17 06:45:08 +00:00
var mouse = c_2dto3d(mouse_x,mouse_y);
2022-08-16 22:28:01 +00:00
if select && selectedunit == noone {
2022-08-17 06:45:08 +00:00
var mousex = floor(mouse.x/global.tilesize.x);
var mousey = floor(mouse.y/global.tilesize.y);
2022-08-15 04:06:41 +00:00
log(mousex, mousey);
2022-08-17 05:05:33 +00:00
if mousex < array_length(global.map) && mousex >= 0 {
if mousey < array_length(global.map[mousex]) && mousey >= 0 {
2022-08-15 04:06:41 +00:00
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 {
2022-08-18 20:47:07 +00:00
var dude = global.map[mousex][mousey].contents[i];
if dude.alignment == global.turn {
c_selectunit(dude);
} else {
c_markunit(dude);
}
2022-08-15 04:06:41 +00:00
}
}
}
}
2022-08-16 22:28:01 +00:00
} else if select {
2022-08-17 06:45:08 +00:00
if mouse.x > global.gw-100 {
var guyhits = floor(abs(mouse.y-global.gh-10)/32);
2022-08-16 22:28:01 +00:00
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;
}
2022-08-16 22:39:22 +00:00
}
2022-08-17 16:49:45 +00:00
if selectedunit == noone {
hspd = lerp(hspd, (right-left)*((.1+stop*.1)*(ts.x)), .4);
vspd = lerp(vspd, (down-up)*((.1+stop*.1)*(ts.y)), .4);
x += hspd;
y += vspd;
} else {
hspd = 0;
vspd = 0;
x = lerp(x, selectedunit.x, .4);
y = lerp(y, selectedunit.y, .4);
}
2022-08-16 22:39:22 +00:00
2022-08-17 16:49:45 +00:00
global.camerax = x;
global.cameray = y;
2022-08-17 06:45:08 +00:00
var mousex = floor(mouse.x/global.tilesize.x);
var mousey = floor(mouse.y/global.tilesize.y);
2022-08-16 22:39:22 +00:00
//log(mousex, mousey);
hoveredunit = selectedunit;
2022-08-17 05:05:33 +00:00
if mousex < array_length(global.map) && mousex >= 0 {
if mousey < array_length(global.map[mousex]) && mousey >= 0 {
2022-08-16 22:39:22 +00:00
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]);
}
}
}
2022-08-17 06:45:08 +00:00
}
2022-08-18 20:47:07 +00:00
var i;
for (i=0; i<array_length(global.units[global.turn]); i++) {
if global.units[global.turn][i].waiting = false exit;
}
2022-08-18 20:50:51 +00:00
c_dewait(global.turn);
global.turn = (global.turn+1)%2;
log("TURN " + string(global.turn));