This is absolutely fantastic!
After a few hours of modifying code, I got it to work with a tower defense game I'm making. I have next to no experience with LÖVE but it was super easy to implement!
Löve "Light vs. Shadow" Engine [0.4.3]
Re: Löve "Light vs. Shadow" Engine [0.4.2]
When trying the example.lua, I get this error:
(Here's a screenshot: http://puu.sh/7YJ6t.png)
I noticed that this error does not occur when I comment outin love.update(). However, I obviously can't move the light then. It also happens if I try to set the position to static values such as 5, 5. The main.lua does work, by the way.
EDIT: Just found it a moment after posting this, while comparing main.lua and example.lua (because main.lua works). The function lightMouse.setPosition() needs 3 values instead of 2, because one is required for the z-value (height) of the light.
This should also be changed in the example code in the wiki, as the code there also only uses 2 values.
Also, any tips on how to implement this when using love.graphics.scale()?
Code: Select all
Error
light.lua:90: Value size of 2 does not match variable size of 3.
Traceback
[C]: in function 'send'
light.lua:90: in function 'update'
main.lua:49: in function 'draw'
[C]: in function 'xpcall'
I noticed that this error does not occur when I comment out
Code: Select all
lightMouse.setPosition(love.mouse.getX(), love.mouse.getY())
EDIT: Just found it a moment after posting this, while comparing main.lua and example.lua (because main.lua works). The function lightMouse.setPosition() needs 3 values instead of 2, because one is required for the z-value (height) of the light.
This should also be changed in the example code in the wiki, as the code there also only uses 2 values.
Also, any tips on how to implement this when using love.graphics.scale()?
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: Löve "Light vs. Shadow" Engine [0.4.2]
Great work! Maybe I can use this in my current game.
I found here an error: if light is exatly near a small object, there will be a strange shadow. (bad resulution, but you know what I mean)
I found here an error: if light is exatly near a small object, there will be a strange shadow. (bad resulution, but you know what I mean)
Re: Löve "Light vs. Shadow" Engine [0.4.2]
I think that could be the "z-level" of the light- imagine a sunrise. The light is "peaking" over the top of the box.
Or it could just be a bug.
Or it could just be a bug.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: Löve "Light vs. Shadow" Engine [0.4.2]
It also happens when z is 0. I don't really know how the shader works yet, but I assume the shadow just isn't drawn far enough because it has a restriction on how big the surface of the shadow can be, or something similar to that.davisdude wrote:I think that could be the "z-level" of the light- imagine a sunrise. The light is "peaking" over the top of the box.
Or it could just be a bug.
Re: Löve "Light vs. Shadow" Engine [0.4.3]
This problem is fixed now.Luke100000 wrote:I found here an error: if light is exatly near a small object, there will be a strange shadow.
I also implemented the love2d browser for the examples.
Re: Löve "Light vs. Shadow" Engine [0.4.3]
How exactly is translation used with this? If I use the lightWorld.setTranslation() before drawing everything, I get this: http://puu.sh/82uxo.jpg while it's supposed to look like this: http://puu.sh/82uyY.jpg
Do I also have to use love.graphics.translate() at some point? Or are there any other functions I need to get it working properly?
Do I also have to use love.graphics.translate() at some point? Or are there any other functions I need to get it working properly?
-
- Citizen
- Posts: 67
- Joined: Fri Mar 07, 2014 8:16 pm
Re: Löve "Light vs. Shadow" Engine [0.4.3]
You will need to use lightWorld.setTranslation() if you are using love's translation. Some more information around here: viewtopic.php?f=5&t=77418&start=20#p164433
Re: Löve "Light vs. Shadow" Engine [0.4.3]
WetDesertRock wrote:You will need to use lightWorld.setTranslation() if you are using love's translation. Some more information around here: viewtopic.php?f=5&t=77418&start=20#p164433
I still get very strange results with this. Do I have to use love's translation too? If so, when? And do I use the standard values there, or the ones your function returns?
I'm not using the Hump camera by the way, I'm using my own which is basically just love.graphics.translate() packed into nice functions and smooth movement.
-
- Citizen
- Posts: 67
- Joined: Fri Mar 07, 2014 8:16 pm
Re: Löve "Light vs. Shadow" Engine [0.4.3]
If you set the light worlds translation by the same value you set loves translation, and it messes up, then its a bug I think. But you should set both values to the same.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests