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

@ -10,6 +10,6 @@ function c_input() {
rightp = keyboard_check_pressed(ord("D")) + keyboard_check_pressed(vk_right);
select = mouse_check_button_pressed(mb_left) + keyboard_check_pressed(vk_enter);
back = mouse_check_button_pressed(mb_right) + keyboard_check_pressed(vk_escape);
back = mouse_check_button_pressed(mb_right) + keyboard_check_pressed(vk_escape) + keyboard_check_pressed(ord("Q"));
stop = keyboard_check(vk_shift);
}

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;

View file

@ -24,7 +24,7 @@ function c_informtiles() {
}
}
c_informtiles();
global.tilesize = new vec2(32, 32);
global.tilesize = new vec2(20, 20);
function tiledata(passable_=true, contents_=[], overlays_=[], statmods=[]) constructor {
passable = passable_;