x += mng.mouseMoveX();
bat.y += mng.mouseMoveY();
}
case et_quit:
running = false;
default:
}
curTime = Timer.getCurrent();
if ( kTimer.isTime() )
fps = 1000.00 / (curTime - prevTime);
prevTime = curTime;
if (gTimer.isTime())
{
if (keys[0]) bat.y -= 1;
if (keys[1]) bat.y += 1;
if (keys[2]) bat.x -= 1;
if (keys[3]) bat.x += 1;
if( batSrf.collisionPixel( batSrf, bat.getCurrentRect(),
bat2.getCurrentRect(), bat.getSpriteOffset( bat2 ) ) )
mng.clear( 0xFF0000 );
else if( batSrf.collisionBox( bat.getCurrentRect(), bat2.getCurrentRect(),
bat.getSpriteOffset( bat2 ) ) )
mng.clear( 0xFF9900 );
else
mng.clear( 0x00000000 );
bat.animate( iTimer );
bat2.animate( jTimer );
mng.flip();
}
}
batSrf.free();
mng.close();
}
public function processKeys( key, pressed : Bool )
{
switch key
{
case 27:
running = false;
case 273:
keys[0] = pressed;
(continued)
Chapter 19: Multimedia with Neko
553
case 274:
keys[1] = pressed;
case 275:
keys[3] = pressed;
case 276:
keys[2] = pressed;
default:
neko.
Pages:
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027