move you self

This commit is contained in:
the me 2022-08-16 15:28:01 -07:00
parent 9cdac2b47e
commit 4d394955fa
18 changed files with 127 additions and 22 deletions

View file

@ -1,9 +1,9 @@
function st_moving() {
var mov = 2;
var mov = data.mov.val;
c_input();
hspd = lerp(hspd, (right-left)*.05, .4);
vspd = lerp(vspd, (down-up)*.05, .4);
//if !stop dir = DIR.NONE;
if !stop dir = DIR.NONE;
if left dir = DIR.LEFT;
if down dir = DIR.DOWN;
if up dir = DIR.UP;
@ -47,7 +47,7 @@ function st_moving() {
//var rng = [1];
var guy = c_gettile(x, y, true);
var hitting = noone;
if guy != noone {
if guy != noone && stop {
switch dir {
case DIR.LEFT:
hitting = c_gettile(guy.x-1, guy.y);
@ -96,6 +96,11 @@ function st_moving() {
if back {
c_deselectunit(id);
}
if dir == DIR.NONE && select {
c_moveunit(id, c_gettile(x, y, true));
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 {