THE KILLSQUARE (does not kill)
This commit is contained in:
parent
cfcfd3e263
commit
47cae629df
|
@ -9,6 +9,7 @@
|
||||||
{"id":{"name":"stat","path":"scripts/stat/stat.yy",},"order":3,},
|
{"id":{"name":"stat","path":"scripts/stat/stat.yy",},"order":3,},
|
||||||
{"id":{"name":"vlambeer","path":"scripts/vlambeer/vlambeer.yy",},"order":1,},
|
{"id":{"name":"vlambeer","path":"scripts/vlambeer/vlambeer.yy",},"order":1,},
|
||||||
{"id":{"name":"x_unitsetup","path":"scripts/x_unitsetup/x_unitsetup.yy",},"order":0,},
|
{"id":{"name":"x_unitsetup","path":"scripts/x_unitsetup/x_unitsetup.yy",},"order":0,},
|
||||||
|
{"id":{"name":"c_decolor","path":"scripts/c_decolor/c_decolor.yy",},"order":10,},
|
||||||
{"id":{"name":"s_guy","path":"sprites/s_guy/s_guy.yy",},"order":0,},
|
{"id":{"name":"s_guy","path":"sprites/s_guy/s_guy.yy",},"order":0,},
|
||||||
{"id":{"name":"easing","path":"scripts/easing/easing.yy",},"order":4,},
|
{"id":{"name":"easing","path":"scripts/easing/easing.yy",},"order":4,},
|
||||||
{"id":{"name":"bint_sort","path":"scripts/bint_sort/bint_sort.yy",},"order":0,},
|
{"id":{"name":"bint_sort","path":"scripts/bint_sort/bint_sort.yy",},"order":0,},
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
{"id":{"name":"format_time","path":"scripts/format_time/format_time.yy",},"order":12,},
|
{"id":{"name":"format_time","path":"scripts/format_time/format_time.yy",},"order":12,},
|
||||||
{"id":{"name":"o_screenshake","path":"objects/o_screenshake/o_screenshake.yy",},"order":0,},
|
{"id":{"name":"o_screenshake","path":"objects/o_screenshake/o_screenshake.yy",},"order":0,},
|
||||||
{"id":{"name":"ncm","path":"scripts/ncm/ncm.yy",},"order":14,},
|
{"id":{"name":"ncm","path":"scripts/ncm/ncm.yy",},"order":14,},
|
||||||
|
{"id":{"name":"c_gettile","path":"scripts/c_gettile/c_gettile.yy",},"order":11,},
|
||||||
{"id":{"name":"sinmult","path":"scripts/sinmult/sinmult.yy",},"order":16,},
|
{"id":{"name":"sinmult","path":"scripts/sinmult/sinmult.yy",},"order":16,},
|
||||||
{"id":{"name":"munction","path":"scripts/munction/munction.yy",},"order":12,},
|
{"id":{"name":"munction","path":"scripts/munction/munction.yy",},"order":12,},
|
||||||
{"id":{"name":"function_append","path":"scripts/function_append/function_append.yy",},"order":13,},
|
{"id":{"name":"function_append","path":"scripts/function_append/function_append.yy",},"order":13,},
|
||||||
|
|
|
@ -4,4 +4,5 @@ state = st_standing;
|
||||||
drawstate = c_null;
|
drawstate = c_null;
|
||||||
hspd = 0;
|
hspd = 0;
|
||||||
vspd = 0;
|
vspd = 0;
|
||||||
returnpos = new vec2(0, 0);
|
returnpos = new vec2(0, 0);
|
||||||
|
dir = DIR.NONE;
|
|
@ -0,0 +1,19 @@
|
||||||
|
function c_decolor(x, y, color) {
|
||||||
|
if x < array_length(mp) && x >= 0 {
|
||||||
|
if y < array_length(mp[x]) && y >= 0 {
|
||||||
|
array_remove(mp[x][y].overlays, color);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function c_decolor_all(color) {
|
||||||
|
var i, j;
|
||||||
|
for (i=0; i<array_length(mp); i++) {
|
||||||
|
for (j=0; j<array_length(mp[i]); j++) {
|
||||||
|
array_remove(mp[i][j].overlays, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#macro mp global.map
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"isDnD": false,
|
||||||
|
"isCompatibility": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "Scripts",
|
||||||
|
"path": "folders/Scripts.yy",
|
||||||
|
},
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "c_decolor",
|
||||||
|
"tags": [],
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
function c_gettile(x, y) {
|
||||||
|
var thex = round((x-16)/ts.x);
|
||||||
|
var they = round((y-16)/ts.y);
|
||||||
|
if c_tileexists(thex, they) return mp[thex][they];
|
||||||
|
return noone;
|
||||||
|
}
|
||||||
|
|
||||||
|
function c_tileexists(posx, posy) {
|
||||||
|
if posx < array_length(mp) && posx >= 0 {
|
||||||
|
if posy < array_length(mp[posx]) && posy >= 0 {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"isDnD": false,
|
||||||
|
"isCompatibility": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "Scripts",
|
||||||
|
"path": "folders/Scripts.yy",
|
||||||
|
},
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "c_gettile",
|
||||||
|
"tags": [],
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
}
|
|
@ -4,6 +4,12 @@ function c_input() {
|
||||||
up = keyboard_check(ord("W")) + keyboard_check(vk_up);
|
up = keyboard_check(ord("W")) + keyboard_check(vk_up);
|
||||||
right = keyboard_check(ord("D")) + keyboard_check(vk_right);
|
right = keyboard_check(ord("D")) + keyboard_check(vk_right);
|
||||||
|
|
||||||
|
leftp = keyboard_check_pressed(ord("A")) + keyboard_check_pressed(vk_left);
|
||||||
|
downp = keyboard_check_pressed(ord("S")) + keyboard_check_pressed(vk_down);
|
||||||
|
upp = keyboard_check_pressed(ord("W")) + keyboard_check_pressed(vk_up);
|
||||||
|
rightp = keyboard_check_pressed(ord("D")) + keyboard_check_pressed(vk_right);
|
||||||
|
|
||||||
select = mouse_check_button_pressed(mb_left) + keyboard_check_pressed(vk_enter);
|
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);
|
||||||
|
stop = keyboard_check(vk_shift);
|
||||||
}
|
}
|
|
@ -14,7 +14,9 @@ function c_selectunit(unitobject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function c_colortile(x, y, color) {
|
function c_colortile(x, y, color) {
|
||||||
|
if !c_tileexists(x, y) return false;
|
||||||
if !array_contains(global.map[x][y], color) {
|
if !array_contains(global.map[x][y], color) {
|
||||||
array_push(global.map[x][y].overlays, color);
|
array_push(global.map[x][y].overlays, color);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -1,17 +1,27 @@
|
||||||
function st_moving() {
|
function st_moving() {
|
||||||
var mov = 2
|
var mov = 2;
|
||||||
c_input();
|
c_input();
|
||||||
|
|
||||||
hspd = lerp(hspd, (right-left)*.05, .4);
|
hspd = lerp(hspd, (right-left)*.05, .4);
|
||||||
vspd = lerp(vspd, (down-up)*.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 - (
|
var remainingmov = mov+1 - (
|
||||||
abs(x+hspd-16-pos.x*ts.x)/ts.x +
|
abs(x+hspd-16-pos.x*ts.x)/ts.x +
|
||||||
abs(y+vspd-16-pos.y*ts.y)/ts.y
|
abs(y+vspd-16-pos.y*ts.y)/ts.y
|
||||||
);
|
);
|
||||||
//var shitmode = point_distance(x, y, pos.x*ts.x, pos.y*ts.y);
|
//var shitmode = point_distance(x, y, pos.x*ts.x, pos.y*ts.y);
|
||||||
//if shitmode > mov*ts.x {
|
//if shitmode > mov*ts.x {
|
||||||
x += hspd*ts.x;
|
if !stop {
|
||||||
y += vspd*ts.y;
|
x += hspd*ts.x;
|
||||||
|
y += vspd*ts.y;
|
||||||
|
}
|
||||||
while !remainingmov {
|
while !remainingmov {
|
||||||
hspd = 0;
|
hspd = 0;
|
||||||
vspd = 0;
|
vspd = 0;
|
||||||
|
@ -29,6 +39,27 @@ function st_moving() {
|
||||||
|
|
||||||
}
|
}
|
||||||
prevremainingmov = remainingmov;
|
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 {
|
/*if x < (pos.x-mov)*ts.x {
|
||||||
x = (pos.x-mov)*ts.x;
|
x = (pos.x-mov)*ts.x;
|
||||||
} else if x > (pos.x+mov+1)*ts.x {
|
} else if x > (pos.x+mov+1)*ts.x {
|
||||||
|
@ -65,4 +96,12 @@ function st_movingdraw() {
|
||||||
}
|
}
|
||||||
draw_set_alpha(1);*/
|
draw_set_alpha(1);*/
|
||||||
}
|
}
|
||||||
#macro ts global.tilesize
|
#macro ts global.tilesize
|
||||||
|
|
||||||
|
enum DIR {
|
||||||
|
NONE,
|
||||||
|
LEFT,
|
||||||
|
DOWN,
|
||||||
|
UP,
|
||||||
|
RIGHT,
|
||||||
|
}
|
|
@ -5,6 +5,15 @@ global.map = [
|
||||||
[new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()],
|
[new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()],
|
||||||
[new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()],
|
[new tiledata(), new tiledata(), new tiledata(), new tiledata(), new tiledata()],
|
||||||
];
|
];
|
||||||
|
function c_informtiles() {
|
||||||
|
for (i=0; i<array_length(global.map); i++) {
|
||||||
|
for (j=0; j<array_length(global.map[i]); j++) {
|
||||||
|
mp[i][j].x = i;
|
||||||
|
mp[i][j].y = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c_informtiles();
|
||||||
global.tilesize = new vec2(32, 32);
|
global.tilesize = new vec2(32, 32);
|
||||||
|
|
||||||
function tiledata(passable_=true) constructor {
|
function tiledata(passable_=true) constructor {
|
||||||
|
|
Loading…
Reference in New Issue