MODULE: Lake v1.3

Started by Kweepa, Sun 09/07/2006 04:16:49

Previous topic - Next topic

Kweepa



Creates an animated reflection like the once-popular java lake applets. Reflects a background image (can specify an alternate background frame). Characters and objects are also reflected. You can see the effect in action in this demo:
http://www.kweepa.com/step/ags/games/MegaDemo.zip (5Mb)

Download here:
http://www.kweepa.com/step/ags/tech/LakeModule13.zip (3k)

Instructions are in the module header.
Works with AGS v3.1 and above. (Tested with AGS v3.2.)


History:
1.0. First version. Used a screenshot to reflect objects and characters. Works with AGS v2.72.
http://www.kweepa.com/step/ags/tech/LakeModule10.zip (2k)
1.1. Now takes a baseline to filter objects and characters, and doesn't reflect guis or cursors. Works with AGS v3.1.
1.2. Now works with right-to-left operator precedence. Thanks dualnames.
1.3. Now uses strict object-based scripting.
Still waiting for Purity of the Surf II

Besh

AHHHHHHHHHHHHH!!!Ã, Ã,  :o

WOW!!! Steve you are the BEST!!!
Simply AMAZING.
"Spread our codes to the stars,
You can rescue us all"
- Muse

monkey0506

Pretty impressive stuff.  Not really sure how it works (:=), but it does, so that's good.

Also I'm not entirely clear on what the dinosaur pinball and scrolly notepad have to do with the module...but neat effects anyway.

TheMagician

Wow. Very nice module!
Great work!

This might be a nice starting point for me to code a pixel-shifting algorithm to create water effects as used in Riven for example.

IceMan

Steve, you are a genius!Ã,  ;D

I put together a quick test to see how I might use it in DNG 2.Ã,  I added a few tweaks to complete the effect, such as the rounded pond-edge and a transparent layer of water, so that you still get some blue in there...


Kweepa

#5
Ah, those are just RawDrawn on top. Something like this:
Code: ags

pond.Update();
RawDrawImageTransparent(GFX_BLUE_RECT, 0, 140, 50);
RawDrawImage(GFX_POND_EDGE, 0, 120);


Glad it's going to come in handy!
Also glad to see it works at 640x480. :=
Still waiting for Purity of the Surf II

jasonjkay

This is something ive been waiting for, it looks amazing. Ill definately have to add it to my site.
http://www.americangirlscouts.org/agsresources/ - Mods, plugins and templates.

subspark

#7
IceMan, I and the other graphics gurus of this forum would really appreciate your demo of Steves Lake module also. Or possibly a thorough tutorial of how you acheived your results.

Good work to the both of you.

Cheers.

Privateer Puddin'

#8
Steve said how to do it. As fair as I can see this is correct (but rushed so the overall effect doesn't look any where near as good) and it seems TheMagician got it as well..



very quickly done ;p
without any
with blue transparent
with edge

Sadistyk

Is there anyway that the Lake module works while the Wait() function is running?

Kweepa

Just update it in a repeatedly_execute_always function instead of repeatedly_execute.
If you don't have that function in your room script, create it:
Code: ags

function repeatedly_execute_always()
{
  pond.Update();
}
Still waiting for Purity of the Surf II

GarageGothic

Excellent idea to use an alternate background frame as a buffer for the screenshot. I hadn't thought about that myself, which made me suggest to CJ to add optional coordinates to the CreateFromScreenShot function. But this is a great workaround. Thanks for that ingenious solution - I had actually given up on ever getting my full screen postprocessing to run at decent speed.

Kweepa

I won't be able to get to this for a week or so as I'm on holiday, but if someone else wants to provide a demo game that would be swell.
Still waiting for Purity of the Surf II

Candle

Did you get that template/demo/source yet?

alimpo83

How can I use it correctly in 640x480? When I use it in my game it doesn't appear correctly, well it appears till a part of the screen, then no effect. I have to edit the coordinates and sizes I think, but when I change this part:

this.enabled = true;
  this.x = 0;
  this.y = 100;
  this.w = 320;
  this.h = 100;
  this.speed = 1.0;

to other values the game crashes. What am I doing wrong? Please help!
Thanks.
LIMPO ARTS

Kweepa

You shouldn't need to modify the internals of the module to get it to work at 640x480 - IceMan got it working without doing that. I'll check what you need to do later.
Still waiting for Purity of the Surf II

alimpo83

What i want to change it's the range of the effect. In your demo, basically half the screen gets the water effect, the other half is the background. When I try your module, the effects ends before it reaches the bottom of the screen. I want to be able to control where it starts and where it ends.

Thanks.
LIMPO ARTS

Kweepa

Ok, here's a minimal room script that works.

Code: ags

// room script file
Lake pond;

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: Player enters room (before fadein)
  pond.DefaultConstruct();
  pond.y = 120;
  pond.h = 120;
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for Room: Repeatedly execute
  pond.Update();
}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE


You need to create these interactions and then fill in the code as above.

For 320x240 or 640x480, y can be no smaller than 120 (half of 240) for the effect to reach the bottom of the screen.

In any event, there must be enough screen above the top of the water to reflect into the region you specify. For example, if you want the top of the water to be at pond.y = 60, then the maximum pond.h = 60. I should add that check to the code, but right now you'll have to be careful.

It would be possible to stretch what's available above the water to fill the water vertically, but right now I don't have the time or inclination. Perhaps if someone has a pressing need for the feature, a game about to be released, and asks nicely, I'll see what I can do. :=
Still waiting for Purity of the Surf II

.M.M.

Anybody has that plugin???

Gilbert

This thread is more than a year's old, please try PMing the author before bumping it.

Furthermore, it's a module, not a plugin.

Rui 'Trovatore' Pires

Still MIA? I miss the guy.

Anyway, in the meantime, here's a working link to the Lake module.

http://www.2dadventure.com/ags/LakeModule10.zip
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Gilbert

Thanks Redrum, I had updated the first post. :)

.M.M.


Dualnames

#23
I'm using Steve's wonderful module, and because the topic has been inactive for a while, I thought it was better to post here. It is mostly relative to the module, but not only. Okay, so I'm using it to have a small pond that reflects. Similar to McCarthy. Thing is it's also reflecting the mouse. And I don't recall the one in McCarthy to do that, unless I am mistaken of course. So anyone with any ideas on how NOT to reflect the mouse, but still reflect characters and objects?

Can this be done by any other means apart from the Lake module?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Kweepa

Oops.
I guess reflecting a screenshot is not a viable solution :)
I'll fix it up - I'll add a "baseline" for the water, and reflect just the objects and characters whose baseline is above that.

Steve
Still waiting for Purity of the Surf II

Kweepa

Ok, new version of the Lake module.
http://www.kweepa.com/step/ags/tech/LakeModule11.zip
Works with AGS 3.1 and above.
The Lake object now has a baseline property that can be used to filter out objects and characters. For example, set the baseline to 0 to reflect nothing but the background.

The Lake thread has been updated with the new version.
Still waiting for Purity of the Surf II

Dualnames

Quote from: SteveMcCrea on Sun 03/01/2010 19:08:44
Oops.
I guess reflecting a screenshot is not a viable solution :)
I'll fix it up - I'll add a "baseline" for the water, and reflect just the objects and characters whose baseline is above that.

Steve

WTF is wrong with this community? I wonder how to do a FOG, someone makes it for me. I wonder how to do a reflection, someone makes it for me. I will make a topic that I don't know how to make my game!!! :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

monkey0506

Ah but Dual CJ removed the "Make my game" button... :'(

R.I.P. "Make my game"

Dualnames

Quote from: monkey_05_06 on Sun 03/01/2010 21:12:16
Ah but Dual CJ removed the "Make my game" button... :'(

R.I.P. "Make my game"

DAMN!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Dualnames

Quote from: SteveMcCrea on Sun 03/01/2010 21:01:20
Ok, new version of the Lake module.
http://www.kweepa.com/step/ags/tech/LakeModule11.zip
Works with AGS 3.1 and above.
The Lake object now has a baseline property that can be used to filter out objects and characters. For example, set the baseline to 0 to reflect nothing but the background.

The Lake thread has been updated with the new version.

Damn Steve. Everything seems to work fine on the module on a replica of the room I want to use it in, but when I port it on HHGTG, it just won't work. Setting the baseline even to (100000000) won't do it. I can't have the character drawn in the reflection.

Objects are cool. But there's something that has to do with characters I can't figure it out..
I checked for Baselines but nothing there. I even searched for IgnoreWalkBehinds but not. Even characters I've not teased from default won't show on the lake!

Any ideas?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Shane 'ProgZmax' Stevens

A few things might affect it:

1.  Is the character solid?
2.  Does the character have any transparency?
3.  Check to see if you modified the character baseline to some massive value.


Those are the first things that come to mind that might have some kind of an impact on the module.  Bear in mind this is just a guess as I've never used it.

Kweepa

Quote from: ProgZmax on Mon 04/01/2010 00:12:25
1.  Is the character solid?
2.  Does the character have any transparency?
3.  Check to see if you modified the character baseline to some massive value.
Solidity of character shouldn't matter. Nor should transparency, as that's taken into account. And he did say he messed with the baselines...

How about these questions (and how the answers compare with the working sample):
Is the room scrolling?
What is the resolution/bit depth?
Are there other effects/modules active?
Is the background animating?

Try opening up Lake.asc and putting a breakpoint on line 132 to see if it's being hit. If not, put a breakpoint on line 51 and see if it's obvious why the character isn't being added to the list to be drawn.
If all else fails, can you upload your game somewhere for me to investigate?

Cheers.
Still waiting for Purity of the Surf II

Dualnames

#32
Quote from: SteveMcCrea on Mon 04/01/2010 01:33:27
Quote from: ProgZmax on Mon 04/01/2010 00:12:25
1.  Is the character solid?
2.  Does the character have any transparency?
3.  Check to see if you modified the character baseline to some massive value.
Solidity of character shouldn't matter. Nor should transparency, as that's taken into account. And he did say he messed with the baselines...

How about these questions (and how the answers compare with the working sample):
Is the room scrolling?
What is the resolution/bit depth?
Are there other effects/modules active?
Is the background animating?

Try opening up Lake.asc and putting a breakpoint on line 132 to see if it's being hit. If not, put a breakpoint on line 51 and see if it's obvious why the character isn't being added to the list to be drawn.
If all else fails, can you upload your game somewhere for me to investigate?

Cheers.

Ah! Took me 6 hours. And I found it. It needs setting left-to-right precedence on General Windows Pane set to TRUE! And I had it set to FALSE, for my other modules to work.

Thing is is it possible to tell me what to change so the module works with left-to-right precedence on false? Also, dare I tell that ..well..the character doesn't get tinted on the reflection as it is tinted on region.

*I'm getting a little pesky i know*
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Kweepa

Quote from: Dualnames on Mon 04/01/2010 02:22:10
Ah! Took me 6 hours. And I found it. It needs setting left-to-right precedence on General Windows Pane set to TRUE! And I had it set to FALSE, for my other modules to work.
Well done, sir!
To get it to work with either precedence, you need to bracket all the multiply and divide lines. I suspect it's particularly lines 129-130 that you should replace with:
Code: ags

        int w = (character[in].Scaling*dsf.Width)/100;
        int h = (character[in].Scaling*dsf.Height)/100;


Quote
Also, dare I tell that ..well..the character doesn't get tinted on the reflection as it is tinted on region.
Ugh. I figured someone would ask for that. Let me see if it's possible to fix.

Steve
Still waiting for Purity of the Surf II

Dualnames

Quote from: SteveMcCrea on Mon 04/01/2010 03:11:13
Well done, sir!
To get it to work with either precedence, you need to bracket all the multiply and divide lines. I suspect it's particularly lines 129-130 that you should replace with:
Code: ags

        int w = (character[in].Scaling*dsf.Width)/100;
        int h = (character[in].Scaling*dsf.Height)/100;


Quote
Also, dare I tell that ..well..the character doesn't get tinted on the reflection as it is tinted on region.
Ugh. I figured someone would ask for that. Let me see if it's possible to fix.

Steve

Those aren't the lines! I tried bracketing all of them..but no. I can have a work around this anyway.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Kweepa

I think I misread your post. You need to set left-to-right to FALSE??
That can't be it. I have it set to TRUE in my demo project and it works fine.
Any chance of uploading the game for me to check?
Still waiting for Purity of the Surf II

Dualnames

Quote from: SteveMcCrea on Mon 04/01/2010 03:34:27
I think I misread your post. You need to set left-to-right to FALSE??
That can't be it. I have it set to TRUE in my demo project and it works fine.
Any chance of uploading the game for me to check?

To quote my post above:
Quote
It needs setting left-to-right precedence on General Windows Pane set to TRUE! And I had it set to FALSE, for my other modules to work.

Lake works only on True, while my other modules work on false.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Kweepa

#37
I think I misread your post. The second time! :=
Ok, this fixes it (tested!). Line 132
Code: ags

        ds.DrawImage(character[in].x - w/2, (character[in].y - character[in].z) - h, dsf.Graphic, character[in].Transparency, w, h);


I'll upload the fixed module at some point.

[EDIT] Done:
http://www.kweepa.com/step/ags/tech/LakeModule12.zip
Still waiting for Purity of the Surf II

Dualnames

Quote from: SteveMcCrea on Mon 04/01/2010 04:07:09
I think I misread your post. The second time! :=
Ok, this fixes it (tested!). Line 132
Code: ags

        ds.DrawImage(character[in].x - w/2, (character[in].y - character[in].z) - h, dsf.Graphic, character[in].Transparency, w, h);


I'll upload the fixed module at some point.

[EDIT] Done:
http://www.kweepa.com/step/ags/tech/LakeModule12.zip


Thanks Steve!!!! Life saver there!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

cubehouse

Starting to use AGS in a project very shortly and playing around with some of the (OMGZ AWESOMEZ) things I've been finding on the forums.
Using 3.2 at the moment (the "final" release) and tried to get this working.
The RawDrawImageResized seems to be no longer supported?

Anyway, I genuinely am just hacking about at this as I'm a complete n00b to AGS, but I managed to get this module working with 3.2 (which I don't know if we're meant to be discussing supporting until it's officially released? but I thought I'd post what I did).

I had to replace line 161 in Lake.asc:
        RawDrawImageResized(this.x, this.y + i, s.Graphic, this.w, 1);

with
        #ifver 3.2
        DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
        surface.DrawImage(this.x,  this.y + i, s.Graphic, 0, this.w, 1);
        #endif
        #ifnver 3.2
        RawDrawImageResized(this.x, this.y + i, s.Graphic, this.w, 1);
        #endif

which fixes the compatibility (and backwards compatible! I think I've got the hang of this already!)

and I had to change line 58:
        if ((character.room == player.room)

to
        if ((character.Room == player.Room)

although I don't know if that is right - but it makes it compile and run ;)  (maybe stricter capitalisation checking in 3.2? *shrug*)

Kweepa

Nice work!
(You could also set "Enforce object-based scripting" to false in General Settings and it will work fine. That's not the default though.)
Actually the lake module is now a horrible mish-mash of 2.7 and 3.0 code that will only work with 3.0+. So I might as well just make it AGSv3 only.

http://www.kweepa.com/step/ags/tech/LakeModule13.zip
Still waiting for Purity of the Surf II

cubehouse

Ah ok, not heard of the Enforce object-based scripting thing.
But it's much nicer to have it work "out-of-the-box" so to speak :)

Is a very awesome script  ;D

Quote from: SteveMcCrea on Tue 30/03/2010 03:16:13
Nice work!
(You could also set "Enforce object-based scripting" to false in General Settings and it will work fine. That's not the default though.)
Actually the lake module is now a horrible mish-mash of 2.7 and 3.0 code that will only work with 3.0+. So I might as well just make it AGSv3 only.

http://www.kweepa.com/step/ags/tech/LakeModule13.zip


arj0n


silverwolfpet

#43
I didn't want to write a new topic since we have this one.

I do not understand how you can make characters be reflected in the lake.

32-bit, 1024x756, character sprites are PNGs with transparency.

Any ideas? I've got the latest version of the lake module, and my AGS version is v3.1.2 SP1, February 2009

Help, please?

Code I used in the room:

Code: ags

Lake Room2Lake;

function room_FirstLoad()
{
  Room2Lake.DefaultConstruct();
  Room2Lake.x = 0;
  Room2Lake.y = 500;
  Room2Lake.w = 800;
  Room2Lake.h = 500;
  Room2Lake.yRippleSize = 0.5;
  Room2Lake.xRipplePhaseScale = 0.5;
  Room2Lake.xRipplePhaseScale = 0.5;
}

function room_RepExec()
{
  Room2Lake.Update();
}


EDIT: FOUND the solution!!

For all interested, just play some more with the baselines. You can always use

cEgo.Baseline = 2;  (in the global script)

and then use

Lake.baseline = 4;  (in the room script)

I used to put really low values (like 0 or 1) and it just won't take them. Yay! Fixed it!

But now I has another issue. I'm fading in a title...and as I'm doing that, the lake stops updating.
I tried using

function room_RepExec()
{
 Room2Lake.Update();
}

...but during the fade in of the title (which is an object), the lake won't update. Any ideas? I can move characters while it's fading in...so I have no idea why it's doing that.

EDIT 2: I'm brilliant.

Instead of using a fade IN - fade OUT script, I just (patiently) created 20 sprites (each with +5% transparency) of the title.
THEN I turned it into an object... and I animated that object, specifying not to Block the script (eNoBlock).
Gave it the right timing and voila! It's brilliant!

Thanks :D

placyd

I'm trying to use this module in my game, but I encountered a problem: backgroundFrameIndex doesn't seem to work for me.
I've imported a new background to frame1 and set the code like this:

sea.backgroundFrameIndex=1;

But it isn't working, the water reflects the original background. Can someone help me with this, please?

Another question about the module: is it possible to fully reflect a character which is below the reflection point? For example the character goes into the water. In this case only that part reflects which is above the y coordinate I've set, not the whole character.

Snake

Hello! I'm very sorry, I DO know that there hasn't been any posts in this thread for a very long time :-[

This is a very cool module. I have a blocking animation that stops the water from moving when it is called. Is there a way for this module to ignore blocking commands?
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Dualnames

You could move the lake update to repeatedly_execute_always.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Snake

Hey, Duals, you handsome guy, you. Thank you very much, that is what did the trick! THANKS!
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Julius Dangerous

___________________________________________________________

strangeDetective

I downloaded the Lake module from this site: http://americangirlscouts.org/agsresources/

And got everything working, except the cursor also reflects in the water. I saw that the module was modified to include a baseline for the Lake, to get around this issue. However the version I have does not have anything about setting a baseline in it so it must be an older version. 

The link in the module's forum entry looks like a dead link. Does anyone have an updated version of this module, or know how I can add the code so the lake will have a baseline and not mirror the cursor?

Thanks for any help.

arj0n

@strangeDetective:
I do have v1.2, which was released in 2010.
Not sure if it's updated enough compared to the v1.3 (although v1.2 should work for ags 3.0+ I believe) but you can grab it here if you like.

strangeDetective

Quote from: arj0n on Tue 13/12/2016 22:01:34
@strangeDetective:
I do have v1.2, which was released in 2010.
Not sure if it's updated enough compared to the v1.3 (although v1.2 should work for ags 3.0+ I believe) but you can grab it here if you like.

Thanks a lot, I'll try it out and see. ;-D

strangeDetective

Does anyone who has used the Lake module know how to get the characters tint color to show up in the water reflection? I have the latest updated version, and saw this issue mentioned in the thread but cannot find an example of how to do it?:-\

abstauber

#53
Since I was working on a similar issue, I took the liberty to add these features:
- characters: added tints
- objects: added tints, viewframe animation, scaling and visibility

LakeModule14.zip

Maybe a moderator could update the first post.

--edit:
I just realized, that AGS supports setting all sorts of tints, but getting them seems to impossible. At least I haven't found out if "SetAmbientTint" did something or an object was directly tinted. On the other hand objects seem to ignore region tinting.

Long story short: I only included support for region tinting. For objects you need the object's tint manually to match the region tint (or use SetAmbient Tint)
Also I added this parameter, which has to be set to true in order to apply region tints to objects.

Code: ags

Lake.tintObjects;


Here's an example
Code: ags

Lake pond;

function room_Load()
{
  myObject.IgnoreScaling =false;
  // manually apply the region tint values to the object.
  myObject.Tint(120, 20, 20, 50, 100);
  
  pond.DefaultConstruct();
  // turn on region tinting for object reflections
  pond.tintObjects = true;

  pond.y = 220;
  pond.w = 320;
  pond.h = 160;
  pond.baseline = 160;
  
}



strangeDetective

Quote from: abstauber on Fri 27/01/2017 10:56:36
Since I was working on a similar issue, I took the liberty to add these features:
- characters: added tints
- objects: added tints, viewframe animation, scaling and visibility

Thanks I'll try this out:)

JLM_82

Is there any updates of this module for AGS 3.5 or above?

I downloaded Lake 1.4 (http://shatten.sonores.de/wp-content/uploads/2017/01/LakeModule14.zip), imported it in the "Scripts" -section, and then got the following error when testing the game:

Code: ags
Lake.asc(139): Error (line 139): undefined symbol 'GetViewportY'


What could be a reason, and is there an easy fix available?

Besides, I'd like to know if there is ANYWHERE available proper instructions how the module should be used in the game? For example, how I should tell for the module where the lake is located in the background image?

arj0n

for AGS 3.5 or above, just replace the following in the Lake 1.4 script:

GetViewportY() with Game.Camera.Y
GetViewportX() with Game.Camera.X

JLM_82

#57
Quote from: arj0n on Fri 12/02/2021 10:12:19
for AGS 3.5 or above, just replace the following in the Lake 1.4 script:

GetViewportY() with Game.Camera.Y
GetViewportX() with Game.Camera.X

Thanks for the idea, hopefully that works!

Has anyone instructions how the module should be used in practice? Let's say, if I have a 300x200px -sized lake in my 640x400 -background-image, how the module should be put to work in order to animate the water-area in image? I assume that the lake animation should be started by the room event "After fade-in".

arj0n

#58
For all the available options you can use, see the struct info in the lake script header.
Here's a small and very simplistic roomscript example (game res is 320x200):

Code: ags

// room script file
Lake swimmingPoolSurface;

function room_Load()
{
  swimmingPoolSurface.DefaultConstruct();
  swimmingPoolSurface.baseline = 150;
  swimmingPoolSurface.x = 50;
  swimmingPoolSurface.y = 100;
  swimmingPoolSurface.w = 100;
  swimmingPoolSurface.h = 50;
}

function room_RepExec()
{
  swimmingPoolSurface.Update();
}

JLM_82

Quote from: arj0n on Fri 12/02/2021 10:56:25
For all the available options you can use, see the struct info in the lake script header.
Here's a small and very simplistic roomscript example (game res is 320x200):

Code: ags

// room script file
Lake swimmingPoolSurface;

function room_Load()
{
  swimmingPoolSurface.DefaultConstruct();
  swimmingPoolSurface.baseline = 150;
  swimmingPoolSurface.x = 50;
  swimmingPoolSurface.y = 100;
  swimmingPoolSurface.w = 100;
  swimmingPoolSurface.h = 50;
}

function room_RepExec()
{
  swimmingPoolSurface.Update();
}


Ok, thanks. So it seems the lake must always have a rectangular shape? No way to create lakes with irregular or round borders?

If it works like that, maybe I'll create a rectangular lake and put a couple of large AGS-objects (rocks, trees etc.) in front of the lake to hide the straight (unnatural) shorelines.

SMF spam blocked by CleanTalk