How should I go about a lighting system?

Bombini

  • *
  • Posts: 1242
This is very interesting guys!
Could you attach the fixed version?

Cheers!

Luyren

  • *
  • Posts: 1641
There you go. EDIT: updated version later in the thread.

Edit:
Quote
And if I wanted to make a light follow the player... is that possible with your light source behaviour?
The Light Source behavior automatically moves the light source to the actor that created it.

« Last Edit: February 15, 2019, 04:54:55 pm by Luyren »
Working.


Luyren

  • *
  • Posts: 1641
I found a bug with the Tint Screen behavior when you try to apply a tint at an index greater than 0, without having a tint effect in the indexes below, so I'm attaching an update in case you need it. I've attached an image with a way to fix it, and a fixed version of the whole pack. This version also has a custom block to get the elapsed time since an event happened, and an attribute in the Day and Night Cycle behavior that continuously counts the time passed in-game.
Working.

Fayabella

  • Posts: 143
Coming back to this, because-

Now, I can place torches (which have light source behaviour) and remove them.

Randomly, when doing so, I get this:
Code: [Select]
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()
at com.stencyl.behavior::Script$/resizeImage()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib\stencyl\1,00\com\stencyl\behavior\Script.hx:2631]
at MethodInfo-9527()[E:\Stencyl Steffimiwhetsets\stencylworks\games-generated\Forest\Source\scripts\Design_81_81_TintScreen.hx:407]
at com.stencyl::Engine/draw()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib\stencyl\1,00\com\stencyl\Engine.hx:3290]
at com.stencyl::Engine/postUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib\stencyl\1,00\com\stencyl\Engine.hx:2845]
at com.stencyl::Engine/onUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib\stencyl\1,00\com\stencyl\Engine.hx:2791]

Seems to be something with resizing the masks. Could it be something on my end or is it a problem with the behaviour?

Luyren

  • *
  • Posts: 1641
Can you pinpoint exactly in what instances this happens? What code are you using to remove the torches, when it happens, what settings you have for your torches and for the tint screen, be as detailed as possible.

« Last Edit: February 14, 2019, 03:19:39 am by Luyren »
Working.

Fayabella

  • Posts: 143
It appears to only happens once per run of the game (unless I haven't tested enough). And it's not just removing, but placing too.

I haven't tested this enough either, but I think it's only when the game is transitioning light levels.

I use the 'create [actor] at (x) (y) on [layer]' and 'kill [actor]' blocks.

Luyren

  • *
  • Posts: 1641
Sorry, I cannot reproduce the error. If you could get a setup where the error happens every time, that would help. I'm not working on anything related to that at the moment, so even running into it by accident might take a while for me. Worst case you can PM me your game and we can look into it.
Working.

Fayabella

  • Posts: 143
Ah, alright. I can't really reproduce it consistently but it happens. I'll pm you.

Luyren

  • *
  • Posts: 1641
I think I found it. When using fade in, sometimes the initial width and height used would be 0, and setting an image with 0 width and 0 height gives the error. Try the attached fix, and see if the problem persists.

Edit: attached an extra change, to prevent a similar issue.

« Last Edit: February 15, 2019, 04:44:18 pm by Luyren »
Working.

Fayabella

  • Posts: 143
Ah, yes, that was the issue! Thanks again!