Drawing part of a bitmap


Last Updated:

  1. Flying Nosehair

    Flying Nosehair New Member This Topic's Starter

    Joined:
    Jul 13, 2010
    Messages:
    2
    Likes Received:
    0
    I'm making a game called Pakku Pakku Man, which is a Pac-Man clone. For the characters, I'm using a class called AnimatedSprite, and the language is Java. The class file imports
    android.content.Context;
    android.graphics.Bitmap;
    android.graphics.BitmapFactory;
    android.graphics.Canvas;
    android.graphics.Rect;

    What I want to do is make Pakku Pakku Man go through a tunnel on one end of the maze and emerge out the other. Currently, when he tries to go through a tunnel, the program crashes- apparently due to the program trying to draw pixels off screen. I figure what I need to do is have the program not draw any part of Pakku Pakku Man that's off screen. Thus, as he goes through the tunnel, less and less of him is drawn until no part of him is drawn at all until he emerges through the other tunnel of course.
     

    Advertisement
  2. jonbonazza

    jonbonazza Well-Known Member

    Joined:
    Jul 13, 2010
    Messages:
    1,934
    Likes Received:
    458
    This would be much easier done with OpenGL. OpenGL isn't just for 3d Rendering. It also has very powerful methods for animations and 2D drawing. Much more powerful than Canvas can ever do.
     
  3. Flying Nosehair

    Flying Nosehair New Member This Topic's Starter

    Joined:
    Jul 13, 2010
    Messages:
    2
    Likes Received:
    0
    OK, I'll find information on using OpenGL for Android then. Thanks.
     

Share This Page

Loading...