Lighting Dynamics Demo

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: Lighting Dynamics Demo

Post by spynaz »

Alright, thanks guys!
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: Lighting Dynamics Demo

Post by xXxMoNkEyMaNxXx »

Here, I made a pixel effect version completely from scratch:
spynazPE.love
For those who can use canvases and pixel effects.
(815 Bytes) Downloaded 301 times
I couldn't bear your insisting to index tables with strings, why not just use Lua? Instead of

Code: Select all

table["index"]
simply do

Code: Select all

table.index
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Lighting Dynamics Demo

Post by Ref »

Ah!
Lumens doesn't seen to work as expected - just changes diameter of spotlight, not it's intensity (alpha), see demo.
Attachments
spynazPE_test.love
Demo to show problem with light intensity
(16.74 KiB) Downloaded 199 times
Last edited by Ref on Sat Mar 09, 2013 10:25 pm, edited 1 time in total.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Lighting Dynamics Demo

Post by Davidobot »

I like the new version over the previous one.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: Lighting Dynamics Demo

Post by xXxMoNkEyMaNxXx »

It changes the intensity fine on my computer... you have to remember that it's a reciprocal function.
Davidobot wrote:I like the new version over the previous one.
Me too, the trees look cool :)
If you were talking about Ref's vs mine.

I think that I might have messed up with the way I draw the effect, but I'm sure it can be fixed easily enough.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Lighting Dynamics Demo

Post by Ref »

Sorry, couldn't resist!
Don't bother looking at demo if you don't have 72 seconds to waste.
Attachments
Busy_Bee.love
Simple dynamic lighting - no canvas but pixel effect used
(927.35 KiB) Downloaded 208 times
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Lighting Dynamics Demo

Post by Jasoco »

xXxMoNkEyMaNxXx wrote:I couldn't bear your insisting to index tables with strings, why not just use Lua? Instead of

Code: Select all

table["index"]
simply do

Code: Select all

table.index
Serious question, but is there a drawback to doing that? Is one slower or something or is it just a readability thing?

I use that first method when needed. Like if I need to refer to a table entry through the use of a string variable. For instance:

Code: Select all

table = {
  entry1 = "Hello!",
  entry2 = "Nope!"
}

num = 1
var = "entry"..num

print(table[var])

> Hello!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lighting Dynamics Demo

Post by bartbes »

They are equal, but it is way more readable. Consider writing _G["myImage"] = _G["love"]["graphics"]["newImage"]("some/image.png").

And yes, for indexing with variables that is the only way, the 'dot-syntax' only works for names that are also valid identifiers (roughly equatable to potential variable names), but keep in mind that that's a different operation altogether, anyway.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Lighting Dynamics Demo

Post by miko »

Ref wrote:Sorry, couldn't resist!
Don't bother looking at demo if you don't have 72 seconds to waste.
Its 72 seconds of processor time (because of os.clock()), so if on my laptop it runs at 60fps with 0.20 load, then it takes 360 seconds (6 min) to complete. For wall-clock time, you need os.time().
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Lighting Dynamics Demo

Post by Ref »

Thanks!
Didn't appreciate the difference!
Docs say:
"os.clock() Return CPU time since Lua started in seconds."
Thought seconds were seconds - that CPU seconds were then same as Universal seconds.
Good catch!
Really appreciate input.
Edit:
Turns out on my computer that the os.clock() and os.time() happen to give the same elapsed time for this demo.
Demo actually is terminated by bee.buzz:isStopped( ) - when music is over.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 55 guests