Compare commits
No commits in common. "c9ebba829a9520f9b0304a7c23653764221b94a3" and "206c7312073e21097c94d7028008754f9f11a2e4" have entirely different histories.
c9ebba829a
...
206c731207
|
@ -13,7 +13,6 @@ c_addweapon(id, wp.nothing);
|
|||
equippedweapon = noone;
|
||||
waiting = false;
|
||||
targeting = new vec2(0, 0);
|
||||
hitpos = new vec2(0, 0);
|
||||
marked = false;
|
||||
|
||||
continuecombat = function(me, them) {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
state();
|
||||
if data.hp.val <= 0 {
|
||||
c_deselectunit(id);
|
||||
c_deleteunit(pos.x, pos.y, id);
|
||||
}
|
||||
//depth = x;
|
||||
}
|
|
@ -23,5 +23,5 @@ function c_containsunit(x, y) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return noone;
|
||||
return false;
|
||||
}
|
|
@ -39,8 +39,7 @@ function st_moving() {
|
|||
var dude = c_gettile(x+hspd+abs(sprite_width)/4, y+vspd, true);
|
||||
if dude != noone {
|
||||
var dist = c_tiledist(dude.x, dude.y, returnpos.x, returnpos.y);
|
||||
var friend = c_containsunit(dude.x, dude.y);
|
||||
if dist.x + dist.y <= data.mov.val && dude.passable && (friend == noone || friend == id) {
|
||||
if dist.x + dist.y <= data.mov.val && dude.passable {
|
||||
pos.x = dude.x;
|
||||
pos.y = dude.y;
|
||||
if !stop {
|
||||
|
@ -67,53 +66,24 @@ function st_moving() {
|
|||
//log("selecting");
|
||||
//var rng = [1];
|
||||
var guy = c_gettile(x, y, true);
|
||||
if stop {
|
||||
//var dist = c_tiledist();
|
||||
//hitpos.y = clamp(hitpos.y+downp-upp, -data.rng.val, data.rng.val);
|
||||
//hitpos.x = clamp(hitpos.x+rightp-leftp, -(data.rng.val-abs(hitpos.y)), (data.rng.val-abs(hitpos.y)));
|
||||
//hitpos.y = clamp(hitpos.y, -(data.rng.val-abs(hitpos.x)), (data.rng.val-abs(hitpos.x)));
|
||||
var shits = c_tiledist(0, 0, hitpos.x+rightp-leftp, hitpos.y+downp-upp);
|
||||
var dist = shits.x + shits.y;
|
||||
if dist <= data.rng.val && !(data.rng.val && hitpos.x == 0 && hitpos.y == 0) {
|
||||
hitpos.x += rightp-leftp;
|
||||
hitpos.y += downp-upp;
|
||||
} else {
|
||||
switch dir {
|
||||
case DIR.LEFT:
|
||||
hitpos.x = -1;
|
||||
hitpos.y = 0;
|
||||
break;
|
||||
case DIR.DOWN:
|
||||
hitpos.x = 0;
|
||||
hitpos.y = 1;
|
||||
break;
|
||||
case DIR.UP:
|
||||
hitpos.x = 0;
|
||||
hitpos.y = -1;
|
||||
break;
|
||||
case DIR.RIGHT:
|
||||
hitpos.x = 1;
|
||||
hitpos.y = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
var hitting = noone;
|
||||
if guy != noone {
|
||||
hitting = c_gettile(guy.x+hitpos.x, guy.y+hitpos.y);
|
||||
switch dir {
|
||||
case DIR.LEFT:
|
||||
hitting = c_gettile(guy.x-1, guy.y);
|
||||
sprite_index = data.down;
|
||||
image_xscale = -1;
|
||||
break;
|
||||
case DIR.DOWN:
|
||||
hitting = c_gettile(guy.x, guy.y+1);
|
||||
sprite_index = data.down;
|
||||
break;
|
||||
case DIR.UP:
|
||||
hitting = c_gettile(guy.x, guy.y-1);
|
||||
sprite_index = data.up;
|
||||
break;
|
||||
case DIR.RIGHT:
|
||||
hitting = c_gettile(guy.x+1, guy.y);
|
||||
sprite_index = data.down;
|
||||
image_xscale = 1;
|
||||
break;
|
||||
|
@ -134,10 +104,8 @@ function st_moving() {
|
|||
if hitting.contents[i].object_index = o_unit {
|
||||
log("is unit");
|
||||
log("found two");
|
||||
if hitting.contents[i].alignment != alignment ^^ !data.str.val {
|
||||
c_moveunit(id, c_gettile(pos.x, pos.y));
|
||||
c_generatecombatstack([id, hitting.contents[i]]);
|
||||
}
|
||||
c_moveunit(id, c_gettile(x, y, true));
|
||||
c_generatecombatstack([id, hitting.contents[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue