Löve "Light vs. Shadow" Engine [0.4.3]

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by Ranguna259 »

Weird stuff right there. Glad you got it to work :megagrin:
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by davisdude »

InsomniaNY wrote:So I got it working, though I'm not exactly show why it works this way. Here's what I had to do to get it to work:

Code: Select all

	lightMouse.setPosition(p.x, p.y)
	mouseP = {love.mouse.getPosition()}
	angleMouse_toPlayer = math.atan2(mouseP[1] - p.x, mouseP[2] - p.y)
	lightMouse.setDirection(angleMouse_toPlayer + math.pi)
The problem is that you're using the x coordinates first in math.atan2, you should use the y coordinates as the first argument, i.e.:

Code: Select all

math.atan2(mouseP[2] - p.y, mouseP[1] - p.x)
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
InsomniaNY
Prole
Posts: 4
Joined: Sat Aug 09, 2014 8:58 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by InsomniaNY »

davisdude wrote:
InsomniaNY wrote:So I got it working, though I'm not exactly show why it works this way. Here's what I had to do to get it to work:

Code: Select all

	lightMouse.setPosition(p.x, p.y)
	mouseP = {love.mouse.getPosition()}
	angleMouse_toPlayer = math.atan2(mouseP[1] - p.x, mouseP[2] - p.y)
	lightMouse.setDirection(angleMouse_toPlayer + math.pi)
The problem is that you're using the x coordinates first in math.atan2, you should use the y coordinates as the first argument, i.e.:

Code: Select all

math.atan2(mouseP[2] - p.y, mouseP[1] - p.x)
I think you misunderstood what I was saying. When I had math.atan2(y,x) it didn't work. When I switched it to math.atan2(x,y) because I figured I might as well try, it worked perfectly. I know it's supposed to be y,x....but for some reason it's working the opposite for me.

NOTE: I'm simply working with the light right now, I haven't implemented any shadow objects...though I don't think that matters.

I'll be inserting shadow objects shortly, but I had run into a speedbump... I'm importing a tmx file created in Tiled for my map, which I was hoping I could auto-generate shadowobjects from based on my "Walls" layer, but apparently that's not possible (or I just can't see documentation on how that would be done)...I tried creating a normal map png file, but it seems I'll have to create individual shadow objects for each platform/wall in my level.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by davisdude »

Ah. My bad. That's quite odd, though.
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
FryDay444
Prole
Posts: 6
Joined: Thu Aug 28, 2014 4:42 pm
Contact:

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by FryDay444 »

Will these shaders work on a mobile device (Love for Android or iOS)?
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by jjmafiae »

Can I use this in a commercial project and what about credit?
User avatar
megalukes
Citizen
Posts: 94
Joined: Fri Jun 27, 2014 11:29 pm
Location: Brazil

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by megalukes »

Sorry for bothering again, but did someone manage to solve the translate and scale issues? Thanks!
User avatar
nucular
Prole
Posts: 22
Joined: Sun Mar 16, 2014 1:23 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by nucular »

Is it possible to get the "light shine" drawn by drawShadow() and draw it on the screen in multiply mode (to allow the light rays to be blocked by the objects) without modifying the library? Actually I'm kinda confused by these functions... mind to elaborate a bit in the documentation?
ThatMattGuy
Prole
Posts: 1
Joined: Sun Oct 26, 2014 7:26 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by ThatMattGuy »

Hello!

I am new to Love2d and want to know how you use physics alongside of this? Would I need to have a physics world and a light world?

Thanks
User avatar
Guard13007
Party member
Posts: 132
Joined: Sat Oct 25, 2014 3:42 am
Location: Internet, USA
Contact:

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by Guard13007 »

ThatMattGuy wrote:I am new to Love2d and want to know how you use physics alongside of this? Would I need to have a physics world and a light world?
Yes. Good luck and don't give up!

(I'm relatively new too, and working with this engine as well (albeit the other one which is a rewrite).)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests