camera schmoovin

This commit is contained in:
the me 2022-08-17 09:49:45 -07:00
parent bc06894859
commit 1e6aa9f530
12 changed files with 36 additions and 34 deletions

View file

@ -1,8 +1,8 @@
function st_moving() {
var mov = data.mov.val;
c_input();
hspd = lerp(hspd, (right-left)*.05, .4);
vspd = lerp(vspd, (down-up)*.05, .4);
hspd = lerp(hspd, (right-left)*.07, .4);
vspd = lerp(vspd, (down-up)*.07, .4);
if !stop dir = DIR.NONE;
if left dir = DIR.LEFT;
if down dir = DIR.DOWN;
@ -47,27 +47,23 @@ function st_moving() {
//var rng = [1];
var guy = c_gettile(x, y, true);
var hitting = noone;
if guy != noone && stop {
if guy != noone {
switch dir {
case DIR.LEFT:
hitting = c_gettile(guy.x-1, guy.y);
c_colortile(guy.x-1, guy.y, c_red);
sprite_index = data.down;
image_xscale = -1;
break;
case DIR.DOWN:
hitting = c_gettile(guy.x, guy.y+1);
c_colortile(guy.x, guy.y+1, c_red);
sprite_index = data.down;
break;
case DIR.UP:
hitting = c_gettile(guy.x, guy.y-1);
c_colortile(guy.x, guy.y-1, c_red);
sprite_index = data.up;
break;
case DIR.RIGHT:
hitting = c_gettile(guy.x+1, guy.y);
c_colortile(guy.x+1, guy.y, c_red);
sprite_index = data.down;
image_xscale = 1;
break;
@ -77,7 +73,8 @@ function st_moving() {
break;
}
if hitting != noone && select {
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;