Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Overlapping 2d images

Started by ColdJava Sep 15, 2004 at 3:55 PM 5 replies 1.3k views
Original Post
ColdJava
ColdJava
Im working on developing a low-level rogue-like game in Java 1.5.0 at the moment. I've done plenty of programming in Java and I understand all of the math and syntax involved. But I have been having trouble in getting two images to overlap properly without having the white background still on an image. Heres the scenario - I have a blue background, and a black ninja I made in paint and saved as a .png file. I cropped the ninja all the way down as low as I could (5x5). When I create a new image and draw him on the applet, he has the white background from paint still there overlapping the blue background. I just want the ninja to appear and have the blue background behind him. Perhaps this is just a beginners problem =P and the solution is right in front of me. Do I need to possible save the image as another type of file? Use some type of class that fixes this problem? Thanks in advance.
Reaper_Unreal
Reaper_Unreal
I've had this problem myself. When MS Paint edits a PNG file it ignores the alpha channel and writes it as all solid. What you need to do is use Photoshop or PSP to edit the image instead. They've also got a smart crop feature, so that should help a bit.
She walked into my office like a centipede with 98 missing legs.
garazdawi
garazdawi
Quote:
Original post by Anonymous Poster
In fact, MS's crap programmers affect all MS software: MSIE has for many years been unable to display PNG's, and still is broken, which is part of why GIF's are still so widely used: because MS can't be bothered to support the successor. Sigh.
Yet another reason to use Firefox and not IE :D
garazdawi - 'I put the laughter back in slaughter'
Kurioes
Kurioes
Heh :) My website detects the user-agent and if it's mozilla uses alpha blenden pngs; dithered gifs otherwise. IE sucks - download mozilla or firefox.
jjac7212
jjac7212
convert *ALL your images to gifs (preferably 8 bit) make sure their transparency is set and never use MSPaint ever again. in your paint method, make sure the background is drawn first, then ninja or watever. having your images as 8bit gifs will greatly decrease the size and loading time of images. ive been doing this for ages now and my 4 java applet games have worked perfectly ever since.
flangazor
flangazor
The Gimp is free and can edit png files and save their alpha channels properly.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.