E
Exequiel
Guest
iwant to have flashlight with on and off switch.
so hears my code:
turn = false
if keyboard_check_released(ord('F')) && turn = false {
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.92); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_vision, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target();<--not important
draw_set_blend_mode(bm_normal); <--not important
turn = true
}
else if keyboard_check_released(ord('F')) && turn = true
{
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.97); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_sight, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target(); <--not important
draw_set_blend_mode(bm_normal); <--not important
turn = false
}
i tried this code but, it only work when i hold down the F
:
turn = false
if keyboard_check(ord('F')) {
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.92); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_vision, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target();<--not important
draw_set_blend_mode(bm_normal); <--not important
}
else
{
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.97); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_sight, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target(); <--not important
draw_set_blend_mode(bm_normal); <--not important
}
so hears my code:
turn = false
if keyboard_check_released(ord('F')) && turn = false {
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.92); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_vision, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target();<--not important
draw_set_blend_mode(bm_normal); <--not important
turn = true
}
else if keyboard_check_released(ord('F')) && turn = true
{
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.97); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_sight, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target(); <--not important
draw_set_blend_mode(bm_normal); <--not important
turn = false
}
i tried this code but, it only work when i hold down the F
:
turn = false
if keyboard_check(ord('F')) {
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.92); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_vision, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target();<--not important
draw_set_blend_mode(bm_normal); <--not important
}
else
{
surface_set_target(surf); <--not important
draw_set_color(c_black); <--not important
draw_set_alpha(0.97); <--not important
draw_rectangle(0, 0, room_width, room_height, false); <--not important
draw_set_alpha(1); <--not important
draw_set_blend_mode(bm_subtract); <--not important
draw_sprite_ext(spr_sight, 0, x-view_xview, y - view_yview,1,1, point_direction(x,y, mouse_x,mouse_y), c_white, 1);
surface_reset_target(); <--not important
draw_set_blend_mode(bm_normal); <--not important
}
Attachments
-
135.6 KB Views: 4