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.

SMF spam blocked by CleanTalk