Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Help with drawing water across...


Recommended Posts

I'm using Game Maker 6.1, and in my beach level I'm trying to figure out an easier way to draw water across a certain y axis across the whole level. So can anyone help me draw a rectangle with the image blend of 0.5 and draw it across a certain y axis in the level? I can't figure out how to do it.:confused:

Link to comment
Share on other sites

draw_set_alpha(0.5);
draw_set_color(c_blue);

if( view_yview+view_hview >= global.water_level)
    draw_rectangle(view_xview , max( view_yview,global.water_level ) ,
                   view_xview + view_wview , view_yview + view_hview , 0 );

You could probably do it without the max (just substiture global.water_level) and you could use a min with the view_yview+view_hview, but this way makes the most sense to me.

Edit: come to think, you might see a small streak at the bottom if the water's bellow the screen and probably wastes a tiny bit of time (though I doubt much), so I added an if statement.

Link to comment
Share on other sites

Here's an alternative to what Kain mentioned:

EDIT:

x = view_xview;
y = max( floor(objPlayer.y) - view_hview, global.water_height, view_yview );

draw_set_alpha( 0.5 );
draw_set_color(c_blue);
draw_rectangle( floor(x), floor(y), 
view_xview + view_wview, view_yview + view_hview, false );
draw_set_color(c_white);

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...