Nightime, any ideas how to add that to my game?
As many people know (I've been asking questions about my game earlyer (How do I do?)) my game is pretty much only JPanels & JLabels. I've been for a long time (But I don't have any ideas) wanted to add nightime.
There are two different layers.
The GlassPane layer, where I have the character & mobs.
The Normal layer, where I have ground / things that you can walk on.
What I need is some way to add nightime.
Would be great if I could add multiple layers to the GlassPanes JPanels (If possible).
Because I want to be able to set up like torches in the game. Which will provide light.
Thanks,
Ah
Re: Nightime, any ideas how to add that to my game?
Maybe you should take a look at JavaFX 2.0, currently in beta. JavaFX haslighting effects.
Note that it's non-trivial to mix Swing and JavaFX and that FX effects can only be applied to FX Nodes (equivalient of component in AWT/Swing).
db
Re: Nightime, any ideas how to add that to my game?
I think this would be a littlebit too advanced for me.
Are there any easyer way? :-/
But thanks anyways! :-)
Re: Nightime, any ideas how to add that to my game?
That is the easier way!
db
Re: Nightime, any ideas how to add that to my game?
i looked at your game on youtube, i had an idea, you could used timed animations to change the contrast of each individual square :) althought that might take a while
Re: Nightime, any ideas how to add that to my game?
Well I actually have my own "particle emitter" and "lighting" classes set up. The particle emitter one is a bit more advanced, but the lighting one is pretty easy. Basically you chose a point on the JPanel to start. Then you choose the range. Then you choose the falloff. Then, using some polar graphing stuff, you create multiple rings around this point. Each pixel will have it's RBG value modified slightly, to make it a little bit greyer. Then, as this gets further out, the amount that is changed is reduced based off of the falloff value. The hard part here is modifying the byte and bit code of the pixels, which isn't really too hard as long as you use some of the default methods to convert them into the 255 code that you are used to.
But yeah, you could try something like that if you want.