ugokeru
This commit is contained in:
parent
1c893940ac
commit
cfcfd3e263
21 changed files with 227 additions and 7 deletions
|
@ -4,5 +4,6 @@ function c_inheritunit(x, y, unit_) {
|
|||
chump.pos.x = x;
|
||||
chump.pos.y = y;
|
||||
chump.sprite_index = unit_.sprite;
|
||||
array_push(global.map[x][y].contents, chump);
|
||||
return chump;
|
||||
}
|
9
eastern flames/scripts/c_input/c_input.gml
Normal file
9
eastern flames/scripts/c_input/c_input.gml
Normal file
|
@ -0,0 +1,9 @@
|
|||
function c_input() {
|
||||
left = keyboard_check(ord("A")) + keyboard_check(vk_left);
|
||||
down = keyboard_check(ord("S")) + keyboard_check(vk_down);
|
||||
up = keyboard_check(ord("W")) + keyboard_check(vk_up);
|
||||
right = keyboard_check(ord("D")) + keyboard_check(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);
|
||||
}
|
12
eastern flames/scripts/c_input/c_input.yy
Normal file
12
eastern flames/scripts/c_input/c_input.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "Scripts",
|
||||
"path": "folders/Scripts.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "c_input",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
20
eastern flames/scripts/c_selectunit/c_selectunit.gml
Normal file
20
eastern flames/scripts/c_selectunit/c_selectunit.gml
Normal file
|
@ -0,0 +1,20 @@
|
|||
function c_selectunit(unitobject) {
|
||||
unitobject.state = st_moving;
|
||||
unitobject.drawstate = st_movingdraw;
|
||||
unitobject.returnpos = new vec2(unitobject.pos.x, unitobject.pos.y);
|
||||
var mov = 2//DONT
|
||||
var i, j;
|
||||
for (i=-mov; i<=mov; i++) {
|
||||
for (j=-mov; j<=mov; j++) {
|
||||
if abs(i)+abs(j) <= mov {
|
||||
c_colortile(unitobject.pos.x+i, unitobject.pos.y+j, c_cyan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function c_colortile(x, y, color) {
|
||||
if !array_contains(global.map[x][y], color) {
|
||||
array_push(global.map[x][y].overlays, color);
|
||||
}
|
||||
}
|
12
eastern flames/scripts/c_selectunit/c_selectunit.yy
Normal file
12
eastern flames/scripts/c_selectunit/c_selectunit.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "Scripts",
|
||||
"path": "folders/Scripts.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "c_selectunit",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
function linear_approach(val, goal, amount) {
|
||||
if abs(val-goal) < amount val = goal;
|
||||
if val < goal return val+amount;
|
||||
if val > goal return val-amount;
|
||||
if val == goal return goal;
|
||||
}
|
12
eastern flames/scripts/linear_approach/linear_approach.yy
Normal file
12
eastern flames/scripts/linear_approach/linear_approach.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "data",
|
||||
"path": "folders/Scripts/util/data.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "linear_approach",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
68
eastern flames/scripts/st_moving/st_moving.gml
Normal file
68
eastern flames/scripts/st_moving/st_moving.gml
Normal file
|
@ -0,0 +1,68 @@
|
|||
function st_moving() {
|
||||
var mov = 2
|
||||
c_input();
|
||||
|
||||
hspd = lerp(hspd, (right-left)*.05, .4);
|
||||
vspd = lerp(vspd, (down-up)*.05, .4);
|
||||
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;
|
||||
while !remainingmov {
|
||||
hspd = 0;
|
||||
vspd = 0;
|
||||
x = linear_approach(x, pos.x*ts.x+16, 1);
|
||||
y = linear_approach(y, pos.y*ts.y+16, 1);
|
||||
log(x, pos.x*ts.x);
|
||||
log(y, pos.y*ts.y);
|
||||
var remainingmov = mov+1 - (
|
||||
abs(x+hspd-16-pos.x*ts.x)/ts.x +
|
||||
abs(y+vspd-16-pos.y*ts.y)/ts.y
|
||||
);
|
||||
//log("oob, " + string(remainingmov));
|
||||
/*} else {
|
||||
log("not oob!");*/
|
||||
|
||||
}
|
||||
prevremainingmov = remainingmov;
|
||||
/*if x < (pos.x-mov)*ts.x {
|
||||
x = (pos.x-mov)*ts.x;
|
||||
} else if x > (pos.x+mov+1)*ts.x {
|
||||
x = (pos.x+mov+1)*ts.x;
|
||||
} else {
|
||||
x += hspd*ts.x;
|
||||
}
|
||||
if y < (pos.y-mov)*ts.y {
|
||||
y = (pos.y-mov)*ts.y;
|
||||
} else if y > (pos.y+mov+1)*ts.y {
|
||||
y = (pos.y+mov+1)*ts.y;
|
||||
} else {
|
||||
y += vspd*ts.y;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
function st_movingdraw() {
|
||||
/*var mov = 2;
|
||||
draw_set_color(c_cyan);
|
||||
draw_set_alpha(.4);
|
||||
var i, j;
|
||||
for (i=-mov; i<=mov; i++) {
|
||||
for (j=-mov; j<=mov; j++) {
|
||||
if abs(i)+abs(j) <= mov {
|
||||
draw_rectangle(
|
||||
(pos.x+i)*ts.x,
|
||||
(pos.y+j)*ts.y,
|
||||
(pos.x+i+1)*ts.x,
|
||||
(pos.y+j+1)*ts.y, false
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
draw_set_alpha(1);*/
|
||||
}
|
||||
#macro ts global.tilesize
|
12
eastern flames/scripts/st_moving/st_moving.yy
Normal file
12
eastern flames/scripts/st_moving/st_moving.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "Scripts",
|
||||
"path": "folders/Scripts.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "st_moving",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
eastern flames/scripts/st_moving/st_standing.yy
Normal file
12
eastern flames/scripts/st_moving/st_standing.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "Scripts",
|
||||
"path": "folders/Scripts.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "st_standing",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
5
eastern flames/scripts/st_standing/st_standing.gml
Normal file
5
eastern flames/scripts/st_standing/st_standing.gml
Normal file
|
@ -0,0 +1,5 @@
|
|||
function st_standing() {
|
||||
x = pos.x*global.tilesize.x+global.tilesize.x/2;
|
||||
y = pos.y*global.tilesize.y+global.tilesize.y/2;
|
||||
//log(x, y);
|
||||
}
|
12
eastern flames/scripts/st_standing/st_standing.yy
Normal file
12
eastern flames/scripts/st_standing/st_standing.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "Scripts",
|
||||
"path": "folders/Scripts.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "st_standing",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
|
@ -10,4 +10,5 @@ global.tilesize = new vec2(32, 32);
|
|||
function tiledata(passable_=true) constructor {
|
||||
passable = passable;
|
||||
contents = [];
|
||||
overlays = [];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue