Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  day/night, lighting  (Read 1987 times)
0 Members and 1 Guest are viewing this topic.
Offline bedelf

Junior Devvie

Are you suggesting coconuts migrate?

« Posted 2003-01-15 05:13:13 »

Anyone know how to take a pixel and make it look shaded or darker? If a character walks under a tree I'd like to shade his sprite, or when nighttime comes make it look dark all-around (including the background for that matter). Older games seemed to slowly apply some kinda blue to darker blue on the pixels for this. I've been looking around for something for a bit and I haven't found anything that really seems to apply.
Offline pepe

Junior Devvie

Nothing unreal exists

« Reply #1 - Posted 2003-01-15 05:50:43 »

I think there are some methods:
If you want the sprite to be darkened globally:
- if you are using paletized sprites, simply change the palette. Smiley
- if you are using true color sprites, you can:
 - use an other bank of sprites, showing the other colors (memory expensive)
 - apply a blue transparent mask over the sprite ( cpu and memory expensive)

if you want it to be partially darkened when coming into shadow, the only solution i think of is using shadow masks.

Home page:
GoSub: java2D gamechmark
Offline bedelf

Junior Devvie

Are you suggesting coconuts migrate?

« Reply #2 - Posted 2003-01-15 06:06:49 »

Well that was fast. Tongue

I've never dealt with any palette stuff, I understand how they work kinda, just not when it comes to using them in games. Day/night wouldn't happen automatically so I would need to generate a bunch of different blue'ish crap, I'm not sure how that would even be done. Would you end up doing that by hand? I haven't a clue really.

Using separate sprites is not an option in this case.

Applying a blue transparency.. I haven't done that either but it sounds easier, but I've heard it's dog-ass slow since you can't get that to be hardware accelerated? I'm working off extremely fragmented memory/pices of things I've read so I could be horribly misinformed.

I'll look into it..

Edit: ok I peeked around.. I'll end up having to make some BufferedImage's with the blue's and the alpha level set and just draw that over the entire screen, Correct?

As far as shading sprites I think that sprites will have to have a BufferedImage just to handle that per frame, figure out which pixels are being drawn and give then some sorta grey/black alpha and set the rest to transparent and then drawing that over the portion of the screen where the sprite is, I'm assuming thats possible. =P

The game acually needs to be able to draw/not draw specific pixels of sprites/areas of the game, and it varies per frame. So it complicates the alpha portion a bit more I think. The main backbuffer I'm using a memory image source type deal where I can just change the pixels and update. I may change that to support having an alpha option for the other graphics in the game, but who knows.

ok NOW I'm tired and rambling, thanks for the help, I think I have a bit more direction then I did before. Time to experiment. Goodnight. =)
Pages: [1]
  ignore  |  Print  

EgonOlsen (79 views)
2018-06-10 19:43:48

EgonOlsen (59 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (261 views)
2018-05-13 18:23:11

nelsongames (160 views)
2018-04-24 18:15:36

nelsongames (158 views)
2018-04-24 18:14:32

ivj94 (901 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (813 views)
2018-03-24 14:43:53

Solater (177 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!