Spike Posted November 14, 2008 Report Share Posted November 14, 2008 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 More sharing options...
VectorSatyr Posted November 14, 2008 Report Share Posted November 14, 2008 I did what you're avoiding, pretty much. There's no shame to it, water is not supposed to draw attention. Link to comment Share on other sites More sharing options...
Spike Posted November 14, 2008 Author Report Share Posted November 14, 2008 Yeah, I'm trying to avoid using a lot of objects though. Link to comment Share on other sites More sharing options...
OverbounD Posted November 14, 2008 Report Share Posted November 14, 2008 Its only one object. I made one object that would draw a semitransparent square on the view (view only it will save memory) and make it relative to the object. If sonic was below the objWater then it would draw the water on the view and change the physics. Link to comment Share on other sites More sharing options...
Kain Posted November 14, 2008 Report Share Posted November 14, 2008 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 More sharing options...
OverbounD Posted November 15, 2008 Report Share Posted November 15, 2008 you pretty much do the same thing as I Kain. The only difference is I place the water object at the level I want the water to be up to and use its y concordant for the water level. Link to comment Share on other sites More sharing options...
Spike Posted November 15, 2008 Author Report Share Posted November 15, 2008 Both good ideas. I guess I could use switches to change the water level between sections, huh? Link to comment Share on other sites More sharing options...
OverbounD Posted November 15, 2008 Report Share Posted November 15, 2008 If you need to have different water heights I would just do what I did but make one instance for every source of water you can use the instance create code to set a variable that could act as the width. This would allow you to use one object with one instance for each source of water. Link to comment Share on other sites More sharing options...
Recommended Posts