Steve's Underwater module

Started by ZapZap, Mon 20/05/2013 20:43:19

Previous topic - Next topic

ZapZap

 So I was trying to use this module and when using the fakescreen I don't really understand what are the parameters I need to put... one int for objects another one for characters and the baseline? I don't really get it (the numbers I 'intuitively' try result in error) 
Please help! it's for the current MAGS so I'd need it soon
"Loose ends have a way of strangling you"

Khris

I looked at the module and the function is defined as:

function Enable(int frameToCopyFrom, int frameToCopyTo, int baseLine);

The first two parameters are referring to background frames, which are numbered from 0 to 4.
I don't know exactly what this module does; I assume it creates a copy of the current screen by drawing characters and objects to a background frame, in order to allow the image to be distorted, right?

ZapZap

Oh thanks! I don't know why I thought those int had to do something with chars and objects. Now I don't have the error message, but I still don't know how to make the characters and objects "blurry", I've tried using a walkbehind as Steve said  but they just disappear.
  Sorry it's just that I can't understand half the code in FakeScreen, I'm bad at scripting
"Loose ends have a way of strangling you"

Khris

I have played around with this and I can't get it to work properly.

As far as I can see, the idea is to import the background three times, then use a) FakeScreen.Enable(2, 1, 199), which basically creates a screenshot and draws it to background frame 1, and b) Underwater.Enable(), which takes background frame 1 and draws a distorted copy to background frame 0.
It does work, kind of, but I get artifacts and the distortion looks odd, as if it's not properly reset each frame. It doesn't look as clean as in the demo.

Edit: actually, it does.

Ok, here's what I did:

-I imported the same background three times, adding two background frames to the default one.
-I drew a walkbehind covering the screen, setting its baseline to 199
-I put this in room_AfterFadein:
Code: ags
  FakeScreen.Enable(2, 1, 199);
  Underwater.Enable();

Note that the FakeScreen module should be above the UnderWater one in the project tree, so that FakeScreen's repeatedly_execute is called first.

ZapZap

Thanks it works!! Just 2 problems:

1) I had a label working to display the names of objects chars hotspots, inventory items... now it just works on inventory items. I'm guessing that's because the fakescreen's walkbehind covering the real deal makes it impossible for the pointer to "track" them?
It also seems to prevent any cursor interaction possible...
2) I'm guessing I can't use normal walkbehinds... right? I had a little one that now doesn't work but I guess I could just change the background a bit so it's no needed,

"Loose ends have a way of strangling you"

Khris

Yeah, these are all side effects of the module.

You can emulate walkbehinds using non-clickable objects.
As for hotspot text, you'd have to manually detect everything. It's a lot of work but doable. (As in, compare each character's position to the mouse position, determine if the pixel is within the current sprite and not transparent, same for objects. Hotspots are easy, you can get them using Hotspot.GetAtScreenXY().)

ZapZap

 Uff. I still have to script half of it and I don't have time to learn that stuff  :undecided:
I guess I'll try to make it without the fakescreen, the effect only for backgrounds. Could work changing some things I guess.
Thanks anyway Khris
"Loose ends have a way of strangling you"

SMF spam blocked by CleanTalk