• 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!

draw_surface ignores draw order?

Kyon

Member
Hi everyone, I'm trying to make a little lake in this small new project of mine.
And for some reason my draw_surface ignores the draw order? Or maybe it's the shader.

So this is my code:
Code:
for (i=0; i<4; i++;){
        draw_sprite(sBG3,0,(cam_x/6)+(i*2000),0);
        draw_sprite(sBG2,0,(cam_x/10)+(i*2000),0);
        shader_set(shdWater);
            shader_set_uniform_f(uTime,current_time/3000);
            draw_surface_ext(water,2*2000,watery,1,1,0,image_blend,1);
        shader_reset();
        if i=2{draw_sprite(sBG1b,0,i*2000,0)}else{draw_sprite(sBG1,0,i*2000,0);}
    }
We are the point of i=2.
So what is being drawn on TOP of everything should be sBG1b (which is the floor with a transparant hole in it, in which the surface "water" should come through..
But instead, the draw_surface_ext seems to be drawn on top of the sBG1b.

As you see here:



Sooooo, maybe it's the shader? or are surfaces always drawn on top of the draw order?
Or is it because of the the for-loop?

This is what's inside the surface "water" btw:
Code:
surface_set_target(water);
 
                    draw_clear_alpha(c_white,0);
                    draw_sprite_ext(sBG2,0,(cam_x/10),0,1,-.2,image_angle,image_blend,image_alpha);
                    draw_set_alpha(.4);
                    draw_rectangle_color(0,0,2000,60,watercol,watercol,watercol2,watercol2,false);
                    draw_set_alpha(1);
 surface_reset_target();


Desired effect:
(I achieved this by drawing the draw_rectangle_color not inside the surface, but just at the place after where the surface is drawn right now..)




EDIT:
So I "fixed" it by not making it a surface at all, but just drawing what I wanted to draw inside a shader. Still very weird though. This is a small project, and I only wanted to draw one thing so it's cool, but why did this happen?
 
Last edited:
Top