range marking
This commit is contained in:
parent
d8e6a82fdb
commit
26eabf966d
58 changed files with 774 additions and 76 deletions
|
@ -13,10 +13,10 @@ function st_moving() {
|
|||
if upp dir = DIR.UP;
|
||||
if rightp dir = DIR.RIGHT;
|
||||
var remainingmov = mov+1 - (
|
||||
abs(x+hspd-16-pos.x*ts.x)/ts.x +
|
||||
abs(y+vspd-16-pos.y*ts.y)/ts.y
|
||||
abs(x+hspd-16-returnpos.x*ts.x)/ts.x +
|
||||
abs(y+vspd-16-returnpos.y*ts.y)/ts.y
|
||||
);
|
||||
//var shitmode = point_distance(x, y, pos.x*ts.x, pos.y*ts.y);
|
||||
//var shitmode = point_distance(x, y, returnpos.x*ts.x, returnpos.y*ts.y);
|
||||
//if shitmode > mov*ts.x {
|
||||
if !stop {
|
||||
x += hspd*ts.x;
|
||||
|
@ -25,23 +25,25 @@ function st_moving() {
|
|||
while !remainingmov {
|
||||
hspd = 0;
|
||||
vspd = 0;
|
||||
x = linear_approach(x, pos.x*ts.x+16, 1);
|
||||
y = linear_approach(y, pos.y*ts.y+16, 1);
|
||||
log(x, pos.x*ts.x);
|
||||
log(y, pos.y*ts.y);
|
||||
x = linear_approach(x, returnpos.x*ts.x+16, 1);
|
||||
y = linear_approach(y, returnpos.y*ts.y+16, 1);
|
||||
log(x, returnpos.x*ts.x);
|
||||
log(y, returnpos.y*ts.y);
|
||||
var remainingmov = mov+1 - (
|
||||
abs(x+hspd-16-pos.x*ts.x)/ts.x +
|
||||
abs(y+vspd-16-pos.y*ts.y)/ts.y
|
||||
abs(x+hspd-16-returnpos.x*ts.x)/ts.x +
|
||||
abs(y+vspd-16-returnpos.y*ts.y)/ts.y
|
||||
);
|
||||
//log("oob, " + string(remainingmov));
|
||||
/*} else {
|
||||
log("not oob!");*/
|
||||
|
||||
}
|
||||
var dude = c_gettile(x, y, true);
|
||||
pos.x = dude.x;
|
||||
pos.y = dude.y;
|
||||
prevremainingmov = remainingmov;
|
||||
c_decolor_all(c_red);
|
||||
c_decolor_all(c_green);
|
||||
var guy = c_gettile(x, y, true);
|
||||
var guy = c_gettile(pos.x, pos.y);
|
||||
c_colortile(guy.x, guy.y, c_green);
|
||||
//log("selecting");
|
||||
//var rng = [1];
|
||||
|
@ -73,8 +75,8 @@ function st_moving() {
|
|||
break;
|
||||
|
||||
}
|
||||
if hitting != noone && stop c_colortile(hitting.x, hitting.y, c_red);
|
||||
if hitting != noone && select && stop {
|
||||
c_colortile(hitting.x, hitting.y, c_red);
|
||||
log("found one");
|
||||
log(hitting.contents, hitting.x, hitting.y);
|
||||
var i;
|
||||
|
@ -84,6 +86,7 @@ function st_moving() {
|
|||
if hitting.contents[i].object_index = o_unit {
|
||||
log("is unit");
|
||||
log("found two");
|
||||
c_moveunit(id, c_gettile(x, y, true));
|
||||
c_generatecombatstack([id, hitting.contents[i]]);
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +94,7 @@ function st_moving() {
|
|||
}
|
||||
}
|
||||
if back {
|
||||
c_moveunit(id, c_gettile(returnpos.x, returnpos.y));
|
||||
c_deselectunit(id);
|
||||
}
|
||||
if dir == DIR.NONE && select {
|
||||
|
@ -98,17 +102,17 @@ function st_moving() {
|
|||
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 {
|
||||
x = (pos.x+mov+1)*ts.x;
|
||||
/*if x < (returnpos.x-mov)*ts.x {
|
||||
x = (returnpos.x-mov)*ts.x;
|
||||
} else if x > (returnpos.x+mov+1)*ts.x {
|
||||
x = (returnpos.x+mov+1)*ts.x;
|
||||
} else {
|
||||
x += hspd*ts.x;
|
||||
}
|
||||
if y < (pos.y-mov)*ts.y {
|
||||
y = (pos.y-mov)*ts.y;
|
||||
} else if y > (pos.y+mov+1)*ts.y {
|
||||
y = (pos.y+mov+1)*ts.y;
|
||||
if y < (returnpos.y-mov)*ts.y {
|
||||
y = (returnpos.y-mov)*ts.y;
|
||||
} else if y > (returnpos.y+mov+1)*ts.y {
|
||||
y = (returnpos.y+mov+1)*ts.y;
|
||||
} else {
|
||||
y += vspd*ts.y;
|
||||
}*/
|
||||
|
@ -124,10 +128,10 @@ function st_movingdraw() {
|
|||
for (j=-mov; j<=mov; j++) {
|
||||
if abs(i)+abs(j) <= mov {
|
||||
draw_rectangle(
|
||||
(pos.x+i)*ts.x,
|
||||
(pos.y+j)*ts.y,
|
||||
(pos.x+i+1)*ts.x,
|
||||
(pos.y+j+1)*ts.y, false
|
||||
(returnpos.x+i)*ts.x,
|
||||
(returnpos.y+j)*ts.y,
|
||||
(returnpos.x+i+1)*ts.x,
|
||||
(returnpos.y+j+1)*ts.y, false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue