2022-08-15 04:06:41 +00:00
|
|
|
function c_selectunit(unitobject) {
|
|
|
|
unitobject.state = st_moving;
|
|
|
|
unitobject.drawstate = st_movingdraw;
|
|
|
|
unitobject.returnpos = new vec2(unitobject.pos.x, unitobject.pos.y);
|
|
|
|
var mov = 2//DONT
|
|
|
|
var i, j;
|
|
|
|
for (i=-mov; i<=mov; i++) {
|
|
|
|
for (j=-mov; j<=mov; j++) {
|
|
|
|
if abs(i)+abs(j) <= mov {
|
|
|
|
c_colortile(unitobject.pos.x+i, unitobject.pos.y+j, c_cyan);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-16 01:01:09 +00:00
|
|
|
ARTICULATOR.selectedunit = unitobject;
|
|
|
|
}
|
|
|
|
|
|
|
|
function c_deselectunit(unitobject) {
|
|
|
|
if ARTICULATOR.selectedunit != unitobject return false
|
2022-08-16 02:04:23 +00:00
|
|
|
unitobject.sprite_index = unitobject.data.idle;
|
2022-08-16 01:01:09 +00:00
|
|
|
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;
|
2022-08-15 04:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function c_colortile(x, y, color) {
|
2022-08-15 04:36:37 +00:00
|
|
|
if !c_tileexists(x, y) return false;
|
2022-08-15 04:06:41 +00:00
|
|
|
if !array_contains(global.map[x][y], color) {
|
|
|
|
array_push(global.map[x][y].overlays, color);
|
|
|
|
}
|
2022-08-15 04:36:37 +00:00
|
|
|
return true;
|
2022-08-15 04:06:41 +00:00
|
|
|
}
|