clear( 0x00000000 );
batSrf.draw(Manager.getScreen(), new Rect(24, 63, 65, 44), new Point(x, y));
Part III: Extending the Possibilities
540
if ( dir == true )
x = y = x + 10;
else
x = y = x - 10;
if ( x > 150 ) dir = false;
if ( x < 40 ) dir = true;
mng.flip();
mng.delay( 40 );
}
batSrf.free();
mng.close();
}
}
Make sure to include the bat.png file, or the application will fail.
Setting the Color Key
When drawing the rect of an image to a Surface , you often won ??™ t want to draw every single pixel. For
certain, most game characters aren ??™ t square, and as such, you ??™ ll need a way to remove unwanted pixels
from your image. This is done using a technique called keying .
Keying is a means to provide a mask whereby any pixel that appears within the mask criteria are not
blitted (Bit Block Transfer) to the destination surface. This sort of technique can be seen in film using
chroma - keying, where footage is superimposed onto another while first having all areas of a certain
color removed.
Pages:
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006