R
Rhatos
Guest
I've drawn a rectangle in Draw and have been trying to get my the actual box to change colours when my mouse is inside of the rectangle.
I've tried point_in_rectangle with no luck. If anyone could help me, I would really appreciate it.
Draw Event:
Step Event:
I've tried point_in_rectangle with no luck. If anyone could help me, I would really appreciate it.
Draw Event:
Code:
if(global.WeaponSelect){
//Weapons GUI
//Layer
draw_sprite_ext(sBlack,0,camera_get_view_x(cam)-view_w,camera_get_view_y(cam)-view_h,1,1,0,c_white,0.7)
// Circle Part
draw_circle_color(oGunHolder.x,oGunHolder.y,6,c_red,c_red,false)
//Lines and Boxes
draw_line_color(oGunHolder.x,oGunHolder.y,oGunHolder.x+64,oGunHolder.y-48,c_red,c_red)
draw_rectangle_color(oGunHolder.x+64,oGunHolder.y-64,oGunHolder.x+100,oGunHolder.y-32,box3,box3,box3,box3,true)
draw_line_color(oGunHolder.x,oGunHolder.y,oGunHolder.x,oGunHolder.y-64,c_red,c_red)
draw_rectangle_color(oGunHolder.x-18,oGunHolder.y-96,oGunHolder.x+18,oGunHolder.y-64,box2,box2,box2,box2,true)
draw_line_color(oGunHolder.x,oGunHolder.y,oGunHolder.x-64,oGunHolder.y-48,c_red,c_red)
draw_rectangle_color(oGunHolder.x-60,oGunHolder.y-64,oGunHolder.x-96,oGunHolder.y-32,box1,box1,box1,box1,true)
//Actual line
draw_line_color(oGunHolder.x,oGunHolder.y,mouse_x,mouse_y,c_white,c_white)
}
Code:
if(point_in_rectangle(window_mouse_get_x(),window_mouse_get_y(),oGunHolder.x-60,oGunHolder.y-64,oGunHolder.x-96,oGunHolder.y-32)){
box1 = c_blue
game_end()
} else {
box1 = c_red
}
if(keyboard_check(vk_tab)){
global.WeaponSelect = true
} else {
global.WeaponSelect = false
}