Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

acess array from function

New Here ,
Nov 25, 2015 Nov 25, 2015

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?

TOPICS
ActionScript
289
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Nov 25, 2015 Nov 25, 2015

Set the function argument:

function keypress(e:KeyboardEvent):void {

trace (zone11[1][1]);

}

Translate
Enthusiast ,
Nov 25, 2015 Nov 25, 2015
LATEST

Set the function argument:

function keypress(e:KeyboardEvent):void {

trace (zone11[1][1]);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines