Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / How to turn array from Tier 2 to Tier 1 Dim or array?

Author
Message
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 9th Sep 2018 00:41 Edited at: 9th Sep 2018 00:42
Hi all, how would I turn this array from Tier 2 into Tier 1 Dim or Array?

Thanks!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Sep 2018 02:55
Unfortunately (as far as i know) you cannot initialize multi dimensional arrays like that. Single dimension arrays yes, Multi no.
Single is like this
g_tilemap as integer[3] = [ 1, 2, 3, 4]
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 9th Sep 2018 09:30
Awe man...
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 9th Sep 2018 10:24 Edited at: 9th Sep 2018 10:27
You can do this..



So its the same number of lines to define it as the C version is....
Also combine that with #constant grass 1 and you can fill it exactly as you would a C array


Another way to do it is to define your values as a string "1,1,1,1,1,2,2,2,2,3,3,3,2,1,2"...then use getstringtoken() to fille the array up

Login to post a reply

Server time is: 2024-11-23 04:56:08
Your offset time is: 2024-11-23 04:56:08