wtf it works

This commit is contained in:
the me 2022-08-16 15:39:22 -07:00
parent 641ccd1065
commit aa747e8305
9 changed files with 48 additions and 14 deletions

View file

@ -4,9 +4,11 @@ var i;
c_inheritunit(2+i, 2, un.chara);
}*/
var chara = c_inheritunit(8, 5, un.chara);
c_addweapon(chara, wp.knife, false);
c_addweapon(chara, wp[$"iron sword"], true);
c_inheritunit(10, 5, un.kris);
c_addweapon(chara, wp.knife, true);
c_addweapon(chara, wp[$"iron sword"]);
var kris = c_inheritunit(10, 5, un.kris);
c_addweapon(kris, wp[$"iron sword"], true);
selectedunit = noone;
hoveredunit = noone;
global.gw = 640;
global.gh = 360;

View file

@ -1,15 +1,15 @@
if selectedunit != noone {
if hoveredunit != noone {
draw_set_color(c_black);
draw_rectangle(global.gw, global.gh, global.gw-100, global.gh-(array_length(selectedunit.inventory)-1)*32-16, false);
draw_rectangle(global.gw, global.gh, global.gw-100, global.gh-(array_length(hoveredunit.inventory)-1)*32-16, false);
draw_set_color(c_white);
var i;
draw_set_halign(fa_right);
for (i=1; i<array_length(selectedunit.inventory); i++) {
draw_text(global.gw-10, global.gh-10-i*20, (selectedunit.equippedweapon == i ? "X " : " ") + selectedunit.inventory[i].name);
for (i=1; i<array_length(hoveredunit.inventory); i++) {
draw_text(global.gw-10, global.gh-10-i*20, (hoveredunit.equippedweapon == i ? "X " : " ") + hoveredunit.inventory[i].name);
}
draw_set_halign(fa_left);
var dudes = c_getstats(selectedunit);
var dudes = c_getstats(hoveredunit);
draw_set_color(c_black);
draw_rectangle(0, 0, 100, (array_length(dudes)-1)*32+16, false);
draw_set_color(c_white);

View file

@ -25,4 +25,19 @@ if select && selectedunit == noone {
}
//draw_text(global.gw-10, global.gh-10-i*20;
}
}
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
//log(mousex, mousey);
hoveredunit = selectedunit;
if mousex < array_length(global.map) {
if mousey < array_length(global.map[mousex]) {
var i;
for (i=0; i<array_length(global.map[mousex][mousey].contents); i++) {
if global.map[mousex][mousey].contents[i].object_index == o_unit {
hoveredunit = (global.map[mousex][mousey].contents[i]);
}
}
}
}