Stencyl 3.4.0 is now out. Get it now!

Sine-wave Distortion Effect for Actors (Behavior code now linked)

dtrungle

  • *
  • Posts: 1938
Hello, I cannot get it to work, 
upon compiling I am faced with a DistortionEffect-(49) Class not found
what am I doing wrong?
I really appreciate your help!

Look at my post above yours, name the classname exactly like the copy/pasted code you used.

Irock

  • *
  • Posts: 2842
Code: [Select]
Distortion: com.stencyl.models.Actor has no field currAnimationAsAnim
        from scripts.Design_0_0_Distortion
        line: 89
        columns: 16-58
Distortion: com.stencyl.models.Actor has no field currAnimationAsAnim
        from scripts.Design_0_0_Distortion
        line: 124
        columns: 10-57
Distortion: Too many arguments
        from scripts.Design_0_0_Distortion
        line: 151
        columns: 2-22
Distortion: Function 'new' requires arguments : actor
        from scripts.Design_0_0_Distortion
        line: 151
        columns: 2-22
Set Screenshot to Actor: com.stencyl.models.Actor has no field currAnimationAsAnim
        from scripts.Design_2_2_SetScreenshottoActor
        line: 98

            columns: 0-47

b8230

Repro steps:

  • Test the game

Hectate

  • *
  • Posts: 4643
Been poking around in this (thanks for watching me try to debug). There's definitely some differences between the code mode default template and this one that we fixed, but I still can't figure out why it won't init.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Justin

  • *
  • Posts: 3828
currAnimationAsAnim was a pretty worthless field so I got rid of it. You can use currAnimation to the same effect. I just looked at the pastebin file in the first post, and the constructor looks fine to me. If you just copy whatever a Design Mode behavior generates it should definitely work.

For Live Support: Join our discord channel and ping me @justin.

Hectate

  • *
  • Posts: 4643
Yeah we'd fixed the contructor and tried a few things to replace the (now missing) currAnimationAsAnim. Unfortunately even with the currAnimation fixed it still refused to init.
Quote
com.stencyl.behavior.Behavior#initScript(72): Could not init Behavior: Distortion with scripts.Design_12_12_Distortion

Aaaand I just figured it out after pasting the above and fixed it. The pastebin file has the classname as Design_0_0_Distortion but Stencyl is looking for Design_12_12_Distortion. Sigh.

* Hectate facepalms his face with his palm.

Irock I've fixed this and will explain it to you in IRC in a bit. Once we figure out a safe way to "install" this I'll update the main thread and instructions.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Hectate

  • *
  • Posts: 4643
For other people:
http://pastebin.com/hR71TKYA

Name your new Actor Behavior "Distortion", select Code Mode,  and give it a classname of "Design_12_12_Distortion" (from line 62 of the above pastebin file). If you use a different classname, you'll have to alter that line to match instead.

Make sure you click "Refresh Attributes" after pasting the file into the behavior. All other instructions are valid. Let me know if this fails as I'm short on testing time right now.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.


Hectate

  • *
  • Posts: 4643
Cool. The tidbit about modulo and multiplication for interlaced makes me wonder what it's doing...
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

1MrPaul1

  • *
  • Posts: 1244
Great behavior Hectate!
Thank you for sharing.
Only one question, can you post setting that you had made in sample game?
In your sample waves is so smooth.
When I tried to distort my image, it looks bad. Too visible scanlines

Hectate

  • *
  • Posts: 4643
I don't have access to the original game file(s) anymore. Try lots of values and tweak them, the image itself can have a big impact on how it appears as well. There's some guidelines in the original post on values that seem to work.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

1MrPaul1

  • *
  • Posts: 1244
I tried several days but anyway the output is not ideal.
How do you think can it be because the image is scaled in 220%?

Hectate

  • *
  • Posts: 4643
I couldn't say, sorry.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Hectate

  • *
  • Posts: 4643
Note: I've updated the behavior to theoretically work with animations. It's not properly tested yet, so don't rely on it in Production unless you're satisfied with the results. At the moment, it appears that values will need to be tweaked further once animations are added (same values gives new results, possibly because of the larger image dimensions of an animation overall).

Link to updated code:
http://pastebin.com/BTtJK3Ex

Nope, seems to be too buggy to use. Sorry.

« Last Edit: September 02, 2016, 04:57:24 am by Hectate »
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

squeeb

  • Posts: 1172
does this work on mobile?  or does the performance drop!?

Hectate

  • *
  • Posts: 4643
MdotEdot had it working on mobile, so it should be fine. Performance will depend on the device.

Also, don't use the recent code; it's definitely faulty - I'm just not sure why yet.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.