RealTime LIghting Demo!

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

RealTime LIghting Demo!

Postby Hblade » Tue Mar 20, 2012 7:17 pm

I hope someone can explain how to make this into a circle :P That'd be cool! :D
s.png


Lighting.zip
(424.46 KiB) Downloaded 308 times


HOW IT WORKS:
It uses a canvas, set the canvas to your color, then use the command "SetLight(x, y, width, height);"

But because of an unknown bug, when setting the y, make sure you set +half of height, like this:
Code: Select all
SetLight(xmouse, ymouse+32, 64, 64);

Otherwise, your light is gonna end up above the Y position you told it to.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4364
Joined: Fri Dec 08, 2006 11:14 pm
Score: 168 Give a positive score

Re: RealTime LIghting Demo!

Postby skydereign » Tue Mar 20, 2012 7:36 pm

I wouldn't use a canvas to make circles (at least how I think you are going about it). To do that you need to use putpixel, and it is slow. Nothing realtime about it. Anyway, take a look at the new ged (note you made it rather hard to use with the + and - adjustments based off of width). Also, just to teach you something, you were wasting a lot of loops doing the lineto method. The pen (from setpen) is a square. So you set its width or height, and just put the pixel at the position X, Y.
Attachments
Lighting.zip
(439.61 KiB) Downloaded 149 times
User avatar
skydereign
 
Posts: 3426
Joined: Mon Jul 28, 2008 8:29 am
Score: 566 Give a positive score

Re: RealTime LIghting Demo!

Postby Hblade » Tue Mar 20, 2012 7:40 pm

Oh wow :oops: tahnks sky.

This is fantastic!
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4364
Joined: Fri Dec 08, 2006 11:14 pm
Score: 168 Give a positive score

Re: RealTime LIghting Demo!

Postby bat78 » Sun Jul 08, 2012 9:21 pm

I make the circle decently for flashlight and add sequence.
Do u allow me to add the lighting into the one of my games hblade?
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 342
Joined: Sun Dec 14, 2008 9:13 pm
Location: Fk my location.
Score: 29 Give a positive score

Re: RealTime LIghting Demo!

Postby Hblade » Sat Jul 14, 2012 11:56 pm

Thats up to you lol :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4364
Joined: Fri Dec 08, 2006 11:14 pm
Score: 168 Give a positive score

Re: RealTime LIghting Demo!

Postby 247wkman » Wed Sep 26, 2012 1:50 am

wow- i new canvas would be the best way to that but its scary how little code there was in doing it- i figured drawing shapes at point of origin to 'cut out the dark' would take some kind of 'draw all black in canvas except shapes here etc or having the shapes erase those spots but the canvas would have to be told to redraw etc'. anyway i copy and paste the mousex line and adjusted the dimensions of that, and the original so i get two rectangles- one tall, one wide, so i get a ''cross'' shape! add two more slightly shorter/wider rectangles plus a square and i get a crude circle light (i been asking about how to) but i guess you could probably draw a perfect circle in on line.
247wkman
 
Posts: 58
Joined: Mon Dec 13, 2010 3:55 pm
Score: 3 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 0 guests