Game Development Reference
In-Depth Information
}
}
}
}
Drawing Images
The drawSelf() method is designed to draw the images at the specified position on the
screen:
//Draws the specified bitmap, scaling/translating automatically to fill
//the destination rectangle. If the source rectangle is not null,
//it specifies the subset of the bitmap to draw.
//Parameters
// canvas - a Canvas to hold the drawing calls
// screenX - x position of the left side of the bitmap being drawn
// screenY - y position of the top side of the bitmap being drawn
public void drawSelf(Canvas canvas, int screenX, int screenY){
int imgId = animationSegmentList.get(currSegment)[currFrame];
if (imgId == 4 || imgId == 20 || imgId == 24 || imgId == 28){
//Specified ImageIDs for hero animation
imgId = Math.random()<0.3?imgId:imgId-2;
}
BitmapManager.drawGamePublic(imgId, canvas, screenX, screenY, 0);
}
Search WWH ::




Custom Search