This commit is contained in:
Anumania 2022-08-18 18:03:59 -07:00
commit a9003c47ca
20 changed files with 37 additions and 34 deletions

View file

@ -1,4 +1,5 @@
c_addunit(un.chara, ARMY.US);
c_addunit(un.kris, ARMY.THEM);
var i;
/*for (i=0; i<array_length(global.units[ARMY.US]); i++) {
c_inheritunit(2+i, 2, un.chara);
@ -10,6 +11,8 @@ var kris = c_inheritunit(10, 5, un.kris);
c_addweapon(kris, wp[$"iron sword"], true);
selectedunit = noone;
hoveredunit = noone;
hspd = 0;
vspd = 0;
global.gw = 640;
global.gh = 360;
global.camerax = 0;

View file

@ -27,7 +27,21 @@ if select && selectedunit == noone {
//draw_text(global.gw-10, global.gh-10-i*20;
}
}
if selectedunit == noone {
hspd = lerp(hspd, (right-left)*((.1+stop*.1)*(ts.x)), .4);
vspd = lerp(vspd, (down-up)*((.1+stop*.1)*(ts.y)), .4);
x += hspd;
y += vspd;
} else {
hspd = 0;
vspd = 0;
x = lerp(x, selectedunit.x, .4);
y = lerp(y, selectedunit.y, .4);
}
global.camerax = x;
global.cameray = y;
var mousex = floor(mouse.x/global.tilesize.x);
var mousey = floor(mouse.y/global.tilesize.y);
//log(mousex, mousey);
@ -42,15 +56,3 @@ if mousex < array_length(global.map) && mousex >= 0 {
}
}
}
if(left){
global.camerax--;
}
if(right){
global.camerax++;
}
if(up){
global.cameray--;
}
if(down){
global.cameray++;
}

View file

@ -17,11 +17,11 @@ x = tempx;
y = tempy;
//log(data);
draw_set_color(c_red);
draw_rectangle(0-ts.x/2, 0-ts.y/2-1,
draw_rectangle(0-ts.x/2, 0-sprite_height-1,
0-ts.x/2+(ts.x*(data.hp.val/data.hp.cap)),
0-ts.y/2+1, false
0-sprite_height+1, false
);
draw_text(x, y-ts.y, data.hp.val);
draw_text(0, 0-sprite_height-4, data.hp.val);
//draw_set_color(c_red);
//draw_circle(x, y, 5, false);