This commit is contained in:
Anumania 2022-08-16 23:45:08 -07:00
parent 757034f5b5
commit bc06894859
7 changed files with 129 additions and 12 deletions

View file

@ -11,4 +11,23 @@ c_addweapon(kris, wp[$"iron sword"], true);
selectedunit = noone;
hoveredunit = noone;
global.gw = 640;
global.gh = 360;
global.gh = 360;
global.camerax = 0;
global.cameray = 0;
//these are functions bc c_2dto3d uses them
function getProj(){
return matrix_build_projection_perspective_fov(60,-16/9,1,4000)
}
function getView(){
var _x = global.camerax;
var _y = global.cameray;
var half = (7.5*32)+40;
return matrix_build_lookat(_x,_y+100,100,_x,_y,0,0,0,-1);
}
function setCam(){
var cam = camera_get_active();
camera_set_proj_mat(cam,getProj());
camera_set_view_mat(cam,getView())
camera_apply(cam);
}

View file

@ -1,3 +1,8 @@
var cam = camera_get_active();
global.projMat = camera_get_proj_mat(cam);
global.viewMat = camera_get_view_mat(cam);
setCam();
var i, j, k;
for (i=0; i<array_length(global.map); i++) {
for (j=0; j<array_length(global.map[i]); j++) {
@ -22,6 +27,7 @@ for (i=0; i<array_length(global.map); i++) {
}
}
draw_set_color(c_black);
var i, j;
for (i=0; i<array_length(global.map); i++) {
for (j=0; j<array_length(global.map[i]); j++) {
@ -32,4 +38,8 @@ for (i=0; i<array_length(global.map); i++) {
(j+1)*global.tilesize.y-1, true
);
}
}
}
//matrix_get(matrix_
var a = c_2dto3d(mouse_x,mouse_y);
draw_circle(a.x,a.y,2,false);

View file

@ -1,7 +1,8 @@
c_input();
var mouse = c_2dto3d(mouse_x,mouse_y);
if select && selectedunit == noone {
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
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) && mousex >= 0 {
if mousey < array_length(global.map[mousex]) && mousey >= 0 {
@ -15,8 +16,8 @@ if select && selectedunit == noone {
}
}
} else if select {
if mouse_x > global.gw-100 {
var guyhits = floor(abs(mouse_y-global.gh-10)/32);
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");
@ -27,8 +28,8 @@ if select && selectedunit == noone {
}
}
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
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) && mousex >= 0 {
@ -40,4 +41,16 @@ 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

@ -1,12 +1,28 @@
draw_set_color(c_gray);
draw_set_alpha(0.25);
draw_circle(x,y+5,10,false);
draw_set_alpha(1);
var worldMat = matrix_get(matrix_world);
//this is the location of where i want to draw from !!!
var worldMat2 = matrix_build(x,y,0,90,0,0,1,1,1);
matrix_set(matrix_world,worldMat2);
if waiting image_blend = c_grey else image_blend = c_white;
var tempx = x;
var tempy = y;
x = 0;
y = 0;
draw_self();
drawstate();
x = tempx;
y = tempy;
//log(data);
draw_set_color(c_red);
draw_rectangle(x-ts.x/2, y-ts.y/2-1,
x-ts.x/2+(ts.x*(data.hp.val/data.hp.cap)),
y-ts.y/2+1, false
draw_rectangle(0-ts.x/2, 0-ts.y/2-1,
0-ts.x/2+(ts.x*(data.hp.val/data.hp.cap)),
0-ts.y/2+1, false
);
draw_text(x, y-ts.y, data.hp.val);
//draw_set_color(c_red);
//draw_circle(x, y, 5, false);
//draw_circle(x, y, 5, false);
matrix_set(matrix_world,worldMat);