# Multidimensional arrays in multiple lines

## Recommended Posts

So Im trying to make a simple 2d game and make some sort of collision detection so why not to make a 2 dimensional array but i have no clue how  to write it in multiple lines

```Global \$map[5,5] = [0,0,0,0,0 _
[0,0,0,0,0 _
[0,0,0,0,0 _
[0,0,0,0,0 _
[0,0,0,0,0]```

something like this but it doesn't work

##### Share on other sites
Posted (edited)

Try in this way:

```Global \$map[5][5] = [[0,0,0,0,0], _
[0,0,0,0,0], _
[0,0,0,0,0], _
[0,0,0,0,0], _
[0,0,0,0,0]]```

Edited by FrancescoDiMuro
• 1

Spoiler

Thoughts:

• I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

## Create an account

Register a new account

• ### Similar Content

• By nooneclose
How do I properly convert this to Autoit? This is a VBA macro that I recorded in Excel.
ActiveSheet.Outline.ShowLevels RowLevels:=2 I need this to close my subtotal once it is finished.
any help will be greatly appreciated.
• By iMacg3
Hi,
I was looking into a way to delete a registry key (not a specific value, an entire key) if it is present. I was considering using RegRead and RegDelete. However, RegRead appears to only read values, not just keys. Is there a way to delete an entire registry key if it is present? I have heard that the below function may help.

• By great77
; put the root in a variable \$sRoot = "C:\Project\PHexample\" Global \$sCurrentTime = _NowCalc() ; We can use that variable here Global \$aList = _FileListToArray(\$sRoot, Default, 2) If @error Then Exit ;;;;;;MsgBox(0, "Error", "_FileListToArray returned @error = " & @error) ;;;;;;;;;;;This is a loop that runs from 1 to the number of items listed in the first element of the returned  array For \$i = 1 To UBound(\$aList) - 1     MsgBox(0, "Folder date", \$sRoot & "" & \$aList[\$i] & @CRLF & @CRLF & FileGetTime(\$sRoot & "" & \$aList[\$i], 1, 1))     MsgBox(0, "Folder date", FileGetTime(\$sRoot & "" & \$aList[\$i], 1, 1))      \$a_filenew = StringReplace(StringReplace(StringReplace(_NowCalc(), "/", ""), ":", ""), " ", "")       MsgBox(0, "Folder date", \$a_filenew) \$adex =  _DateDiff('D', FileGetTime(\$sRoot & "" & \$aList[\$i], 1, 1), \$a_filenew)  MsgBox(0,"ade", \$adex) Next I have a code as seen above, but the difference in time is returning zero. I understand that the date yyyymmddhhmmss but how can I find the difference.
The purpose is to try find the difference in days. Any suggestion?
• By TrashBoat
So i have been working on this 2d physics game and added some physics to it but got stuck on this problem that the character ( the cube ) is sliding all the time but it should not do that because of this friction function:
If \$horizontalVelocity > 0 Then If \$inAir Then \$currFriction = \$airFriction \$horizontalVelocity -= \$currFriction \$birbX += \$horizontalVelocity EndIf this line "\$horizontalVelocity -= \$currFriction" should nullify the velocity to 0 but it stays somewhere in 0.09. How do i fix this?
Here's the game's source code and what i have done so far:
Now i don't expect you reading my nasty code and understanding what it does but any help would be appreciated.

Edit: I guess the problem is solved, i have updated the source code if anyone needs it.
• By Dzenan03
I want to make a while loop, that creates variables based on a array. For thist I created the array \$iDsO with the number and the name of folders in an other folder. Every folder has a different name an I want to create variables(arrays) for each folder that show me all the files in that folder. For example: I have the Folder \Folder1. In it there are the Folders \1, \2, \3. In 1, 2 and 3 there are some files(.png). The array for Folder1 is \$iDsO and now I want to crate the arrays \$iDsO1, \$iDsO2 and \$iDsO3 with the files in them can I make something like this:
While \$iDs > 0 ;\$iDs is the number of files in Folder1>> \$iDsO[0] \$iDs#here should come the Foldername for example '1'# = _FileListtoArray(@ProgramFilesDir&"\Folder1\"&\$iDsO[\$iDs]) \$iDs = \$iDs - 1 Wend So that in the End I have three variabels (\$iDs1, \$iDs2 and \$iDs3)

Is this posible or if not what could I do instead ( I don´t know the number of folders in Folder1 in the begining).
×

• Wiki

• Back

• Git