1. Check out our companion app, Forums for Android! Download from Google Play

Drawing part of a bitmap

Discussion in 'Application Development' started by Flying Nosehair, Jul 13, 2010.

  1. Flying Nosehair

    Flying Nosehair New Member
    Thread Starter
    5

    Jul 13, 2010
    2
    0
    5
    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
    163

    Jul 13, 2010
    1,934
    459
    163
    Male
    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
    Thread Starter
    5

    Jul 13, 2010
    2
    0
    5
    OK, I'll find information on using OpenGL for Android then. Thanks.
     

Share This Page

Loading...