Sign in to follow this  

[java] Overlapping 2d images

This topic is 4818 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
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
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

This topic is 4818 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this