Hey guys!
I'm playing around with shaders for the first time and though it's challenging it's a lot of fun.
I'm creating a 2D platformer, where the setting is a cave so I thought it would be neat to have the lightning only just around the player.
However, I'm having a problem where this eclipse of light simply outruns the player as the map starts scrolling (look at the GIF):
I have no clue why this is. I'm using a variable called playPosition that simply tracks the position of the player on the x-axis.
It's almost all in my main.lua which I have enclosed as well if you want to take a look. The shader-code is in the top while the shader is being drawn in love.draw.
I really hope one of you is able to help me.
Shader outruns the player
Re: Shader outruns the player
Before people start requesting for your love file, I think the problem has a connection with the camera.
Looking at your gif, the shader begins to have a problem the moment the camera begins scrolling with the player.
Looking at your gif, the shader begins to have a problem the moment the camera begins scrolling with the player.
Re: Shader outruns the player
Yeah, it looks like a double transformation.
main.lua is not there, by the way. The forum software is bugged when it comes to multiple attachments. It's not possible to be more specific without the code, sorry.
main.lua is not there, by the way. The forum software is bugged when it comes to multiple attachments. It's not possible to be more specific without the code, sorry.
Re: Shader outruns the player
Just a little question, when you say that people are going to request my .love file, deos that mean that I should include the entire folder with all my game files or just a distributed version of the game?
Yes, you were right. It somehow added the position of the player (player.x) to the position of the camera (map.camX) so all I had to was to subtract the latter from the prior. Thank you so much!
Re: Shader outruns the player
That's good to know, thanks. I figured it out (look at my reply to the first post), I'm not sure what a double transformation is, but it sounds like that might have been the issue.
Re: Shader outruns the player
It means something we can run and test, in order to be able to debug ourselves. The idea is that if you have the code and can't figure it out, you can't expect others to figure it out without the code. There aren't many cases such as this in which the problem is evident from the screenshot. Also, not many people post a screenshot.
Dummy replacement images would be OK, if it is runnable. A minimal .love file with just the code necessary to be able to see the problem, even without images, would also be OK.
Re: Shader outruns the player
Gotya, that makes perfect sense. I did include the main.lua file but I guess you couldn't see it due to the bug that you mentioned. I'll make sure to include it in future postspgimeno wrote: ↑Tue Apr 21, 2020 8:28 amIt means something we can run and test, in order to be able to debug ourselves. The idea is that if you have the code and can't figure it out, you can't expect others to figure it out without the code. There aren't many cases such as this in which the problem is evident from the screenshot. Also, not many people post a screenshot.
Dummy replacement images would be OK, if it is runnable. A minimal .love file with just the code necessary to be able to see the problem, even without images, would also be OK.
Who is online
Users browsing this forum: Google [Bot] and 1 guest