Dynamic Shadow In TGB? Yes!
by William Lee Sims · in Torque Game Builder · 08/21/2010 (3:07 am) · 46 replies
When searching around the Hardcore final level, we wanted the power-ups and enemies to be hidden behind pillars. To that end, I found an article on dynamic 2D shadows.
Because it would be too hard to inject myself into the middle of the TGB rendering, I had to modify the steps a little bit. I create an overlay that makes the scene get darker away from our hero's light source. Then, I find all of the pillars currently on the screen and create convex polygons around the main features of the pillars.
It looks pretty nice and it adds a lot of tension and exploration to the game.
My code isn't generic enough for general use, but if you want a headstart, I can send you the class and an outline of its functionality.
Because it would be too hard to inject myself into the middle of the TGB rendering, I had to modify the steps a little bit. I create an overlay that makes the scene get darker away from our hero's light source. Then, I find all of the pillars currently on the screen and create convex polygons around the main features of the pillars.
It looks pretty nice and it adds a lot of tension and exploration to the game.
My code isn't generic enough for general use, but if you want a headstart, I can send you the class and an outline of its functionality.
About the author
#2
08/21/2010 (12:26 pm)
I like it! Send me a copy.
#3
@Alain - You should be seeing the email soon!
08/21/2010 (4:20 pm)
@Aditya - Yep, it's a source code change.@Alain - You should be seeing the email soon!
#4
08/23/2010 (1:51 pm)
Nice work William! Anyway I could get a copy of your code changes? :)
#5
08/23/2010 (4:23 pm)
@Kenneth - Sure! You can either send me an email (which is available through my profile) or drop your email address here.
#6
I saw this article a long time ago and was always interested in implementing it just for fun. Glad to see you got it done. :)
Melv.
08/23/2010 (5:22 pm)
Nice!I saw this article a long time ago and was always interested in implementing it just for fun. Glad to see you got it done. :)
Melv.
#9
08/25/2010 (3:34 pm)
Hey that's nifty =) Good work!
#11
09/16/2010 (1:31 pm)
OK, I think I could use/adapt this in a current project. Could you send it to me too, please? :)
#12
09/16/2010 (5:52 pm)
You guys should be getting the code any minute now!
#13
09/21/2010 (9:18 am)
William thanks for the source! Very nice!!! :D
#14
They might be useful for my current project. Can you send it to me too?
09/30/2010 (9:50 am)
Hi William, the shadows look really cool! :)They might be useful for my current project. Can you send it to me too?
#15
Excellent stuff. I was also hoping there was a way to add these sorts of effects.
If you can also send it to me, I'd be very grateful!
09/30/2010 (7:07 pm)
Hi William,Excellent stuff. I was also hoping there was a way to add these sorts of effects.
If you can also send it to me, I'd be very grateful!
#16
10/02/2010 (6:42 pm)
What's your email cedric?
#17
10/07/2010 (5:02 am)
If you could send me the source, that would be amazingly helpful.
#18
10/08/2010 (12:55 am)
Beautifully done. I might integrate something like this into my own 2D project (it's not TGB, so don't worry about the source). Thanks for the article link in the first post too.
#19
10/08/2010 (2:15 am)
Sorry to everybody! I'm not ignoring you (mostly). I've gotten very busy with 2 projects and a new job, and then my email is broken. I promise I haven't forgotten any of you!
#20
10/10/2010 (4:04 pm)
This is exactly what I came here today looking for. Any chance you could turn this into a resource so we wouldn't have to bother you for it? If not, I'd like a copy, too.
Torque Owner Aditya Kulkarni
Loon Games