Results 1 to 6 of 6
  1. #1
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default 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
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default 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

  3. #3
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default 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! :-)
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default Re: Nightime, any ideas how to add that to my game?

    That is the easier way!

    db

  5. #5
    Bimz is offline Member
    Join Date
    Aug 2011
    Posts
    31
    Rep Power
    0

    Default 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

  6. #6
    TacoManStan is offline Member
    Join Date
    Sep 2011
    Posts
    50
    Rep Power
    0

    Default 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.

Similar Threads

  1. Game ideas please?
    By clydedoris in forum New To Java
    Replies: 6
    Last Post: 02-26-2010, 03:08 AM
  2. very void here, game ideas needed
    By j2me64 in forum Java Gaming
    Replies: 4
    Last Post: 02-25-2010, 07:49 AM
  3. Need ideas here
    By Manfizy in forum New To Java
    Replies: 0
    Last Post: 07-30-2009, 08:07 AM
  4. Need ideas and help for a simple BlackJack Game
    By Dannii in forum New To Java
    Replies: 5
    Last Post: 04-27-2009, 10:53 AM
  5. out of ideas
    By v1nsai in forum New To Java
    Replies: 2
    Last Post: 03-27-2009, 01:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •