43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
c_input();
|
|
if select && selectedunit == noone {
|
|
var mousex = floor(mouse_x/global.tilesize.x);
|
|
var mousey = floor(mouse_y/global.tilesize.y);
|
|
log(mousex, mousey);
|
|
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 {
|
|
log("selected a guy");
|
|
c_selectunit(global.map[mousex][mousey].contents[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if select {
|
|
if mouse_x > global.gw-100 {
|
|
var guyhits = floor(abs(mouse_y-global.gh-10)/32);
|
|
log(guyhits, array_length(selectedunit.inventory));
|
|
if guyhits < array_length(selectedunit.inventory) {
|
|
//log("doing");
|
|
selectedunit.equippedweapon = guyhits+1;
|
|
c_equipweapon(selectedunit, selectedunit.inventory[selectedunit.equippedweapon]);
|
|
}
|
|
//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]);
|
|
}
|
|
}
|
|
}
|
|
} |