Search code examples
javajava-me

Rotation and collision is possible with fillrect() created rectangle?-j2me


I am working on a J2ME landscape game.I have created a rectangle using fillRect() like this.

gr.fillRect(52,180,5,10);

Now I want to do rotation,and check collision with this rectangle.Is this possible?Is there any way to convert this fillrect() image to a sprite? How can I manage it?


Solution

  • I have done it with immutable image.I used same coordinates as fillRect()

    Image source; // the image to be copied    
    source = Image.createImage(...);    
    Image copy = Image
        .createImage(source.getWidth(), source.getHeight());        
    Graphics g = copy.getGraphics();    
    g.drawImage(source, 0, 0, TOP|LEFT);       
    

    But it is impossible to rotate.