Luke Pierson
Member
Hello! So I followed a couple tutorials on how to make a sort of torch effect for my player, and the lighting looks cool, but it seems that as soon as I start moving my player, the torchlight moves faster and so it seems to run off by itself and is not attached to where my player is. How can I make sure that it's moving at the same pace as the player?
I'm confused because I'm simply drawing an ellipse on a surface at the player's end step at positions:
x - (size of ellipse: 1000) * 2, y - size * 2, x + size, y + size
If I'm not mistaken, shouldn't it simply draw a large circle around my player, but always be locked in based on where the x and y of the player is? The light does stop moving when I stop, but the light moves way faster. Why?
Here's the actual code involved:
Anyways, thanks for any help!
I'm confused because I'm simply drawing an ellipse on a surface at the player's end step at positions:
x - (size of ellipse: 1000) * 2, y - size * 2, x + size, y + size
If I'm not mistaken, shouldn't it simply draw a large circle around my player, but always be locked in based on where the x and y of the player is? The light does stop moving when I stop, but the light moves way faster. Why?
Here's the actual code involved:
Create:
Step:
Draw:
Code:
globalvar light;
light = surface_create(2500, 1500);
depth = - 99;
Code:
if room != rm_title {
surface_set_target(light);
draw_set_color(c_ltgray);
draw_rectangle(0, 0, 2500, 1500, false);
surface_reset_target();
}
Code:
if room != rm_title {
gpu_set_blendmode(bm_subtract);
draw_surface(light, Camera.x - 1100, Camera.y - 600);
gpu_set_blendmode(bm_normal);
}
Code:
var size = 1000;
var x1 = x - size * 2;
var y1 = y - size * 2;
var x2 = x + size;
var y2 = y + size;
gpu_set_blendmode(bm_subtract);
surface_set_target(light);
draw_ellipse_color(x1, y1, x2, y2, c_white, c_black, false);
surface_reset_target();
gpu_set_blendmode(bm_normal);
Anyways, thanks for any help!