Jump to content
  • Advertisement
Sign in to follow this  
ColdJava

[java] Overlapping 2d images

This topic is 5035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Guest 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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!