THE KILLSQUARE (does not kill)

This commit is contained in:
the me 2022-08-14 21:36:37 -07:00
parent cfcfd3e263
commit 47cae629df
10 changed files with 123 additions and 6 deletions

View file

@ -1,17 +1,27 @@
function st_moving() {
var mov = 2
var mov = 2;
c_input();
hspd = lerp(hspd, (right-left)*.05, .4);
vspd = lerp(vspd, (down-up)*.05, .4);
//if !stop dir = DIR.NONE;
if left dir = DIR.LEFT;
if down dir = DIR.DOWN;
if up dir = DIR.UP;
if right dir = DIR.RIGHT;
if leftp dir = DIR.LEFT;
if downp dir = DIR.DOWN;
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
);
//var shitmode = point_distance(x, y, pos.x*ts.x, pos.y*ts.y);
//if shitmode > mov*ts.x {
x += hspd*ts.x;
y += vspd*ts.y;
if !stop {
x += hspd*ts.x;
y += vspd*ts.y;
}
while !remainingmov {
hspd = 0;
vspd = 0;
@ -29,6 +39,27 @@ function st_moving() {
}
prevremainingmov = remainingmov;
c_decolor_all(c_red);
c_decolor_all(c_green);
var guy = c_gettile(x, y);
if guy != noone {
c_colortile(guy.x, guy.y, c_green);
switch dir {
case DIR.LEFT:
c_colortile(guy.x-1, guy.y, c_red);
break;
case DIR.DOWN:
c_colortile(guy.x, guy.y+1, c_red);
break;
case DIR.UP:
c_colortile(guy.x, guy.y-1, c_red);
break;
case DIR.RIGHT:
c_colortile(guy.x+1, guy.y, c_red);
break;
}
}
/*if x < (pos.x-mov)*ts.x {
x = (pos.x-mov)*ts.x;
} else if x > (pos.x+mov+1)*ts.x {
@ -65,4 +96,12 @@ function st_movingdraw() {
}
draw_set_alpha(1);*/
}
#macro ts global.tilesize
#macro ts global.tilesize
enum DIR {
NONE,
LEFT,
DOWN,
UP,
RIGHT,
}