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

Best way to do water in GM?


Spike

Recommended Posts

Here's where I get stuck. I'm trying to add water to my game, but I can't think of a way to choose where the water is and show it without just putting transpartent, water colored square objects everywhere. Could anyone give me some pointers on how they did it? I'd really appreciate it.

Link to comment
Share on other sites

What I do is I have an object to mark the water level, but the actual water level is just stored as a variable in my oLevel object (at the beginning of a room, oLevel looks for a water object; if it exists, it grabs its y position and stores it as water_level, also destroys the object; if it doesn't exist, it defines water_level as room_height + 9999). I draw the water with simple code:

y1 = max( water_level, view_yview[0]);
y2 = max( water_level, view_yview[0] + view_hview[0]);
draw_set_alpha( 0.5);
draw_set_color( make_color_rgb(25,25,120) );
draw_rectangle( view_xview[0], y1, view_xview[0] + view_wview[0], y2, 0);
draw_set_alpha(1);

I find that dealing with a y variable instead of a big rectangle to test collision with is easier for Sonic interacting with the water. I also have an object which is a small platform which handles Sonic running on water. It has the wake animation and only follows Sonic when he's moving fast enough and is just above the water line (otherwise it stays out of view).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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