im schmoovin, slightly more
This commit is contained in:
parent
f53d693a0c
commit
e6fc2dcf96
21 changed files with 689 additions and 31 deletions
|
@ -12,35 +12,53 @@ function st_moving() {
|
|||
if downp dir = DIR.DOWN;
|
||||
if upp dir = DIR.UP;
|
||||
if rightp dir = DIR.RIGHT;
|
||||
var remainingmov = mov+1 - (
|
||||
/*var remainingmov = mov+1 - (
|
||||
abs(x+hspd-16-returnpos.x*ts.x)/ts.x +
|
||||
abs(y+vspd-16-returnpos.y*ts.y)/ts.y
|
||||
);
|
||||
);*/
|
||||
var dist = c_tiledist(pos.x, pos.y, returnpos.y, returnpos.y);
|
||||
//var remainingmov = dist.x + dist.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;
|
||||
y += vspd*ts.y;
|
||||
}
|
||||
while !remainingmov {
|
||||
hspd = 0;
|
||||
|
||||
//while !remainingmov {
|
||||
/*hspd = 0;
|
||||
vspd = 0;
|
||||
x = linear_approach(x, returnpos.x*ts.x+16, 1);
|
||||
y = linear_approach(y, returnpos.y*ts.y+16, 1);
|
||||
x = linear_approach(x, returnpos.x*ts.x, 1);
|
||||
y = linear_approach(y, returnpos.y*ts.y, 1);
|
||||
log(x, returnpos.x*ts.x);
|
||||
log(y, returnpos.y*ts.y);
|
||||
var remainingmov = mov+1 - (
|
||||
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+hspd+abs(sprite_width)/4, y+vspd, true);
|
||||
if dude != noone {
|
||||
var dist = c_tiledist(dude.x, dude.y, returnpos.x, returnpos.y);
|
||||
if dist.x + dist.y <= data.mov.val && dude.passable {
|
||||
pos.x = dude.x;
|
||||
pos.y = dude.y;
|
||||
if !stop {
|
||||
x += hspd*ts.x;
|
||||
y += vspd*ts.y;
|
||||
}
|
||||
} else {
|
||||
x -= hspd*ts.x;
|
||||
y -= vspd*ts.y;
|
||||
x = linear_approach(x, returnpos.x*ts.x+abs(sprite_width)/4, 1);
|
||||
y = linear_approach(y, returnpos.y*ts.y, 1);
|
||||
}
|
||||
} else {
|
||||
x -= hspd*ts.x;
|
||||
y -= vspd*ts.y;
|
||||
x = linear_approach(x, returnpos.x*ts.x+abs(sprite_width)/4, 1);
|
||||
y = linear_approach(y, returnpos.y*ts.y, 1);
|
||||
}
|
||||
var dude = c_gettile(x, y, true);
|
||||
pos.x = dude.x;
|
||||
pos.y = dude.y;
|
||||
prevremainingmov = remainingmov;
|
||||
//prevremainingmov = remainingmov;
|
||||
c_decolor_all(c_red);
|
||||
c_decolor_all(c_green);
|
||||
var guy = c_gettile(pos.x, pos.y);
|
||||
|
@ -97,7 +115,7 @@ function st_moving() {
|
|||
c_moveunit(id, c_gettile(returnpos.x, returnpos.y));
|
||||
c_deselectunit(id);
|
||||
}
|
||||
if dir == DIR.NONE && select {
|
||||
if dir == DIR.NONE && select && stop && ARTICULATOR.hoveredunit == id{
|
||||
c_moveunit(id, c_gettile(x, y, true));
|
||||
waiting = true;
|
||||
c_deselectunit(id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue