2016-09-05 76 views
2
Strict 
Import mojo 

Function Main:Int() 
    CreateMapArray() 
    Return 0 
End 

Function DrawRect:Int(x:Int, y:Int, w:Int, h:Int) 

Function CreateMapArray:Int() 
    Local MapArray:Int[10][]  'This code is for creating a 2D array to act as a map. 
    For Local i:Int = 0 Until MapArray.Length() 
     MapArray[i] = New Int[10] 
    End 
    Print("Here") 
    For Local j:Int = 0 Until MapArray.Length() 'This code is to know where to put each rectangle in the 2D array/map. 
     MapArray[j][9] = 1 
     MapArray[0][j] = 1 
     MapArray[9][j] = 1 
     MapArray[j][0] = 1 
     MapArray[j][8] = Rnd(0,2) 
     Print(MapArray[j][8]) 
    End 
    For Local k:Int = 0 Until MapArray.Length()  'This code if for creating the rectangles. 
     For Local l:Int = 0 Until MapArray.Length() 
      If MapArray[k][l] = 1 Then 
       DrawRect:Int(k, l, 5, 5) 
      End 
     End 
    End 
    Return 0 
End 

在此,我在線得到了意想不到的令牌 '功能' 錯誤 '功能的drawRect:INT(X:詮釋,Y爲:int,W爲:int,H:智力)'。順便說一下,這是在猴子X免費版本上完成的。感謝您提前的幫助。意外的標記 '功能'

+0

嗨OP,你解決了你的問題?如果我的回答提供瞭解決方案,請考慮接受它。它有助於社區:) –

回答

0

您沒有使用End關閉DrawRect函數。

Function DrawRect:Int(x:Int, y:Int, w:Int, h:Int) 

End <- missing bit 

或者,您必須完全刪除DrawRect函數聲明。