Here is my current version of it (ignore the bad graphics etc)
For the multiplayer mode I am hoping that the other program can tell the flash program which player number has clicked. Heres a snippet of that area of the code:
var PlayerNumber:Mouse = new Mouse();
if(PlayerNumber == 1) {
thisBall.addEventListener(MouseEvent.CLICK, thisBallClickHandler);
thisBall2.addEventListener(MouseEvent.CLICK, thisBallClickHandler);
thisBall3.addEventListener(MouseEvent.CLICK, thisBallClickHandler);
thisBall4.addEventListener(MouseEvent.CLICK, thisBallClickHandler);
thisBall5.addEventListener(MouseEvent.CLICK, thisBallClickHandler);
thisBall6.addEventListener(MouseEvent.CLICK, thisBallClickHandler);
}
function thisBallClickHandler(event:MouseEvent):void {
hits++;
updateStats();
thisBall.hit=1;
thisBall2.hit=1;
thisBall3.hit=1;
thisBall4.hit=1;
thisBall5.hit=1;
thisBall6.hit=1;
}
var PlayerNumber:Mouse = new Mouse();
if(PlayerNumber == 2) {
thisBall.addEventListener(MouseEvent.CLICK, thisBallClickHandler2);
thisBall2.addEventListener(MouseEvent.CLICK, thisBallClickHandler2);
thisBall3.addEventListener(MouseEvent.CLICK, thisBallClickHandler2);
thisBall4.addEventListener(MouseEvent.CLICK, thisBallClickHandler2);
thisBall5.addEventListener(MouseEvent.CLICK, thisBallClickHandler2);
thisBall6.addEventListener(MouseEvent.CLICK, thisBallClickHandler2);
}
function thisBallClickHandler2(event:MouseEvent):void {
hits2++;
updateStats2();
thisBall.hit=1;
thisBall2.hit=1;
thisBall3.hit=1;
thisBall4.hit=1;
thisBall5.hit=1;
thisBall6.hit=1;
}
I'm hoping that instead of using the Mouse function it will import the other programs code etc. But really that part isn't something I'm familiar with. Check out the .fla file and play around with the code if you like
Also the .swf file may be a bit too large to run freely on Nick's laptop so we may need to find something better
No comments:
Post a Comment