Layer Drawing Issue

B

Bluedevil9981

Guest
So, I have this little bit of drawing code here:

////////////////////
//fow
draw_set_color(c_black);
depth=-999;
for(xx=0; xx<=view_wview[0]; xx+=32) {
for(yy=0; yy<view_hview[0]; yy+=32) {
if point_distance(xx,yy,obj_player.x,obj_player.y)>=256 {draw_rectangle(xx,yy,xx+32,yy+32,false)}
}}
depth=-1000;


It worked great while it was drawing the whole room, though I switched to drawing to view for obvious reasons. However, the layering doesnt seem to work now. The depth of the caller is -1000 at start. The black boxes take up the entirety of the screen, instead of the hud that is supposed to be over it. Changing the depth didnt seem to do anything. I'm sure its a simple fix, though I can't seem to find it. Any help would be great!

Thanks,
BD
 

jo-thijs

Member
Changing the depth inside the draw event indeed does nothing.
The depth value decides in which order draw events are performed,
but they have to be set before the draw events are executed.
They don't draw things on layers.

I do find it wierd though that you don't use view_xview and view_yview anywhere.
Could that be the problem?
Where does the view start, which object is it following and where does obj_player start?
 
B

Bluedevil9981

Guest
Unfortunately, view_x/yview doesn't fix the issue, though I should be using it - Nice catch.

Regarding the depth issue, thank you for clearing up the matter. I suppose I will just make another object dedicated to that depth level and go from there. It would actually make a bit of sense as it happens to involve lighting, which is a complicated matter that would warrant such attention.

Thanks for the help!
 
Top