looks like battle animations to me
This commit is contained in:
parent
64a74d6f36
commit
b0e718f879
12 changed files with 107 additions and 20 deletions
|
@ -97,6 +97,7 @@ function c_doenemyai(target) {
|
|||
break;
|
||||
}
|
||||
c_loadmarkings();
|
||||
waiting = 70;
|
||||
}
|
||||
|
||||
function c_findnearestunit(alignment) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function c_moveunit(targetunit, destination) {
|
||||
var theguy = c_gettile(targetunit.pos.x, targetunit.pos.y);
|
||||
log(theguy.contents);
|
||||
if !array_remove(theguy.contents, targetunit) idhfnjg();
|
||||
/*if !*/array_remove(theguy.contents, targetunit) //idhfnjg();
|
||||
array_push(destination.contents, targetunit);
|
||||
targetunit.pos.x = destination.x;
|
||||
targetunit.pos.y = destination.y;
|
||||
|
|
|
@ -73,6 +73,7 @@ function st_control() {
|
|||
}
|
||||
c_dewait(global.turn);
|
||||
//global.turn = (global.turn+1)%2;
|
||||
k = 0;
|
||||
global.turn = ARMY.THEM;
|
||||
log("TURN " + string(global.turn));
|
||||
state = st_enemyturn;
|
||||
|
|
|
@ -1,19 +1,36 @@
|
|||
function st_enemyturn() {
|
||||
while global.turn == ARMY.THEM {
|
||||
var done = true;
|
||||
for (k=0; k<array_length(global.units[ARMY.THEM]); k++) {
|
||||
var target = global.units[ARMY.THEM][k];
|
||||
if !target.waiting {
|
||||
done = false;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
c_doenemyai(target);
|
||||
}
|
||||
if done {
|
||||
c_dewait(global.turn);
|
||||
state = st_control;
|
||||
global.turn = ARMY.US;
|
||||
}
|
||||
if selectedunit != noone {
|
||||
hspd = 0;
|
||||
vspd = 0;
|
||||
x = lerp(x, selectedunit.x, .4);
|
||||
y = lerp(y, selectedunit.y, .4);
|
||||
cursor.x = mouse_x;
|
||||
cursor.y = mouse_y;
|
||||
global.camerax = x;
|
||||
global.cameray = y;
|
||||
}
|
||||
if waiting {
|
||||
waiting--;
|
||||
exit;
|
||||
}
|
||||
done = false;
|
||||
//for (k=0; k<array_length(global.units[ARMY.THEM]); k++) {
|
||||
var target = global.units[ARMY.THEM][k];
|
||||
selectedunit = target;
|
||||
while !target.waiting {
|
||||
c_doenemyai(target);
|
||||
if waiting exit;
|
||||
}
|
||||
k++;
|
||||
if k >= array_length(global.units[ARMY.THEM]){
|
||||
done = true;
|
||||
}
|
||||
//}
|
||||
if done {
|
||||
c_dewait(global.turn);
|
||||
k = 0;
|
||||
state = st_control;
|
||||
global.turn = ARMY.US;
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,5 +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;
|
||||
x = lerp(x, pos.x*global.tilesize.x+global.tilesize.x/2, .1);
|
||||
y = lerp(y, pos.y*global.tilesize.y+global.tilesize.y/2, .1);
|
||||
//log(x, y);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue