• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM problem with lightning (surface)

G

graviax

Guest
I'm using surface to make a lightning effect in my game.
And this happen
screen 1.png
so the 4 little rectangle are my bullet and the for big squares are my "light sources"
I made a draw event in the light obj to see where the instance really is.

draw event :
Code:
draw_text(x,y,'light');
In my end step event I draw the big square which are linked to the bullet's position in the bullet step event like so :
Code:
light.x = x;
light.y = y;
the light source end step event :
Code:
draw_set_blend_mode(bm_subtract);
surface_set_target(global.light);
draw_set_circle_precision(4);
draw_circle_color(x,y,size,color1,color2,false);
surface_reset_target();
draw_set_blend_mode(bm_normal);
the big squares seems to be in some kind of paralax because when i move, the gap between my bullet and the light source seems to increase like this :
screen 2.png


I found the place where the squares start at the same position than the bullet : screen 3.png

and whenever I try to move my mouse ...screen 4.png
I don't understand
 
A

Aura

Guest
You are supposed to draw things only in the Draw event(s). Apart from that, I don't understand what your issue is. Maybe a written description of what you want to do and what is happening might help. ^^"
 
G

graviax

Guest
You are supposed to draw things only in the Draw event(s). Apart from that, I don't understand what your issue is. Maybe a written description of what you want to do and what is happening might help. ^^"
Sorry i thought this was obvious.
So i want the big squares to match the position of the bullet and the issues is that I've drawn the message "light" on the position of the squares.
and i think you can see that there is in fact a problem
 

obscene

Member
When you draw to a surface or when you draw to GUI, your coordinates are relative to the top left corner of the surface/view as opposed to the top left corner of the room.

Room: 0,0 = top left of room
Surface 0,0 = top left of surface
View 0,0 = top left of view

If your object is located at 800,400 (room) and your view has been moved to 600,400 you would want to draw your effect on the screen at 200,400.
 
Top