question for standing

how to make one image stand on the other image?
[54 byte] By [nickgoldgodla] at [2007-11-27 4:19:48]
# 1
what do mean by standing,are you taking about transparency ?.One image is transparent and other showing through it.
khangharotha at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...
# 2
this pic http://i104.photobucket.com/albums/m173/finalmilk/stairgame.jpgi want the circle stand on the rect like a mario game
nickgoldgodla at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...
# 3
I'm not sure what cirlce stand on the rect mean.Maybe this will help you: http://forum.java.sun.com/thread.jspa?threadID=505366&messageID=2573411
Rodney_McKaya at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...
# 4
i means that like a 2d game some one walk(circle) on the floor(RECT).
nickgoldgodla at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...
# 5

If your circle image has a transparent background when you paint it over the rectangle it will only draw the opaque part of the image.

This way you can place one image on top of the other.

You just have to use a BufferedImage with alpha as your canvas:

BufferedImage.TYPE_INT_ARGB

Rodney_McKaya at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...
# 6

i have other pic much more clearly show what i wants.

this:

http://i104.photobucket.com/albums/m173/finalmilk/ok.jpg

i want make this game the people stand on the blue Rect.

i want know how to make stand on that .

do you know what i means now?

Message was edited by:

nickgoldgodl

nickgoldgodla at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...
# 7

I already gave you the answer.

You create a [url http://java.sun.com/docs/books/tutorial/2d/images/drawonimage.html]BufferedImage[/url] with type [url http://java.sun.com/j2se/1.5.0/docs/api/java/awt/image/BufferedImage.html#TYPE_INT_ARGB]TYPE_INT_ARGB[/url] as your canvas.

Then you draw the background image first on the BufferedImage you created and finally you draw the character picture on the same BufferedImage in the location you want.

You just have to make sure that the character picture background color is transparent so it will not cover the background picture.

If you don't know how painting is done in Swing read this tutorial first:

http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html

And also this article:

http://java.sun.com/products/jfc/tsc/articles/painting

Rodney_McKaya at 2007-7-12 9:26:45 > top of Java-index,Security,Cryptography...