M
Monster25
Guest
Hello! I have a simple surface darkening everything and I have a flashlight sprite going form the player with bm_add. Thing is, everything looks perfect but the flashlight is drawn on a different position rather than the player's position and it moves at different speeds as well. I am using views that follow the player. Here is the draw event of the player where everything lighting based happens. (I create the surf in the create event)
//Lighting
surface_set_target(surf);
draw_clear(c_black);
draw_set_blend_mode(bm_add);
draw_sprite_ext(spr_flashlight,0,x- view_xview[0], y-view_yview[0],1,1,player_angle,c_white,1);
draw_set_blend_mode(bm_normal);
surface_reset_target()
if (surface_exists(surf))
{
draw_set_blend_mode_ext(bm_dest_color, bm_inv_src_alpha)
draw_surface_ext(surf,0,0,1/surfscale,1/surfscale,0,c_white,0.85)
draw_set_blend_mode(bm_normal);
}
else
surf = surface_create(room_width,room_height);
This is my only problem, the sprite gets drawn at a different position. I tried working around this with having the sprite being drawn in another object and updating that object's x and y to match the player through the draw event but the resulting flashlight is a lot weaker than this one.
//Lighting
surface_set_target(surf);
draw_clear(c_black);
draw_set_blend_mode(bm_add);
draw_sprite_ext(spr_flashlight,0,x- view_xview[0], y-view_yview[0],1,1,player_angle,c_white,1);
draw_set_blend_mode(bm_normal);
surface_reset_target()
if (surface_exists(surf))
{
draw_set_blend_mode_ext(bm_dest_color, bm_inv_src_alpha)
draw_surface_ext(surf,0,0,1/surfscale,1/surfscale,0,c_white,0.85)
draw_set_blend_mode(bm_normal);
}
else
surf = surface_create(room_width,room_height);
This is my only problem, the sprite gets drawn at a different position. I tried working around this with having the sprite being drawn in another object and updating that object's x and y to match the player through the draw event but the resulting flashlight is a lot weaker than this one.