Copy link to clipboard
Copied
i'm trying to make a 2d game, i'm still pretty new in flash, but here's my solution to the colision detection.
stage.addEventListener (KeyboardEvent.KEY_DOWN, keypress);
var zone11:Array = new Array(20);
zone11[0] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
zone11[1] = [1,0,1,1,1,1,1,0,0,0,0,0,0,1,2,1,1,1,1,1];
zone11[2] = [1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1];
zone11[3] = [1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1];
zone11[4] = [1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1];
zone11[5] = [1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1];
zone11[6] = [1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1];
zone11[7] = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
zone11[8] = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
zone11[9] = [2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
zone11[10] = [2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
zone11[11] = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
zone11[12] = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
zone11[13] = [1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1];
zone11[14] = [1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1];
zone11[15] = [1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1];
zone11[16] = [1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1];
zone11[17] = [1,1,1,1,1,0,0,0,0,0,0,0,0,0,2,2,1,1,1,1];
zone11[18] = [1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1];
zone11[19] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
trace (zone11[1][1]);
function keypress(){
trace (zone11[1][1]);
}
However i keep getting "Error #1063: Argument count mismatch on spilltest_fla::MainTimeline/keypress(). Expected 0, got 1." on the second trace, but the first trace is fine. why?
Set the function argument:
function keypress(e:KeyboardEvent):void {
trace (zone11[1][1]);
}
Copy link to clipboard
Copied
Set the function argument:
function keypress(e:KeyboardEvent):void {
trace (zone11[1][1]);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now