setFrame( new Rect(156, 63, 65, 44), 0, 1 );
bat2.setFrame( new Rect(288, 63, 65, 44), 0, 2 );
bat2.setFrame( new Rect(420, 63, 65, 44), 0, 3 );
bat.type = at_loop;
bat.group = 0;
bat2.type = at_pingpong;
bat2.group = 0;
bat2.x = 60;
bat2.y = 60;
var iTimer : Timer = new Timer( 5 );
var jTimer : Timer = new Timer( 7 );
var kTimer : Timer = new Timer( 5 );
var gTimer : Timer = new Timer( 25 );
var fps : Float;
running = true;
while (running)
{
mng.events();
switch mng.getEventType()
{
case et_keydown:
processKeys( mng.lastKey(), true );
case et_keyup:
processKeys( mng.lastKey(), false );
case et_mousebutton:
if ( mng.mouseButton() == 1 )
if ( mng.mouseButtonState() == 1 )
{
var tmp : Rect = bat.getCurrentRect();
var batRect : Rect = new Rect( bat.x, bat.y, tmp.w, tmp.h );
if ( mng.clickRect( mng.mouseX(), mng.mouseY(), batRect ) )
bat.click = 1;
(continued)
Part III: Extending the Possibilities
552
else
bat.click = 0;
}
else
{
bat.click = 0;
}
case et_mousemove:
if ( bat.click == 1 )
{
bat.
Pages:
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026