Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
games submitted by our members
Games in WIP (563)
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 1173 times)
0 Members and 1 Guest are viewing this topic.
Offline bedelf

Junior Member




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 Member




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: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline bedelf

Junior Member




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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Grunnt (15 views)
2014-09-23 14:38:19

radar3301 (14 views)
2014-09-21 23:33:17

BurntPizza (31 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (29 views)
2014-09-20 20:14:06

BurntPizza (33 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (75 views)
2014-09-10 13:57:51

TehJavaDev (105 views)
2014-09-10 06:39:09
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!