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.

AppGameKit Classic Chat / How to fill the array with numbers ?

Author
Message
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 15th Apr 2019 20:32
I looked through all the teams on the AppGameKit did not find anything.
Help !! How to do at AppGameKit ?

Code Basic Blitz3d

Restore map_48
For py=0 To 16
For px=0 To 19
Read obj
map_obj_48(px,py)=obj
Next
Next

.map_48
Data 1,4,0,0,41,0,0,16,0,0,10,0,21,22,0,0,0,0,0,0
Data 3,2,39,6,11,63,115,167,0,0,0,7,24,0,0,0,0,0,0,0
Data 222,0,0,40,12,64,116,168,0,0,0,43,37,5,38,42,33,48,49,0
Data 230,0,46,44,13,65,117,169,0,0,0,56,0,0,0,104,52,51,50,0
Data 30,0,47,45,14,66,118,170,18,26,27,28,29,0,0,0,0,0,0,0
Data 67,68,69,70,0,0,0,0,0,0,0,0,161,162,163,60,61,62,0,0
Data 71,72,73,74,0,0,180,181,182,183,0,0,0,0,0,0,0,0,0,0
Data 75,76,77,78,0,0,184,185,186,187,0,0,0,0,0,0,0,0,0,0
Data 123,124,125,126,0,0,188,189,190,191,0,0,0,210,211,212,213,0,0,0
Data 171,172,173,174,0,0,192,193,194,195,0,208,0,0,0,0,0,0,0,0
Data 223,224,225,226,0,0,196,197,198,199,0,0,0,0,216,0,0,0,0,0
Data 119,120,121,122,0,0,200,0,0,0,107,0,0,0,0,0,0,0,0,0
Data 175,176,177,178,0,0,0,0,58,59,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
[url="http://metamorpho-games.blogspot.ru/p/blog-page_4838.html"]my game[/url]
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 15th Apr 2019 21:02
best way is to read from a text file
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 15th Apr 2019 22:51 Edited at: 15th Apr 2019 22:52
Text file is easiest. But if you still want to keep everything in code, you can always use a string table lookup like the example below with about the same amount of code yet with more flexible/sortable formatting:

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 16th Apr 2019 02:54 Edited at: 16th Apr 2019 02:55
Another approach is to create a .json file that you can load using MyArray.load("filename")
The .json file would like like this (very similar to your data statements).
You could use SFSW's awesome code to create it by executing map_obj.save("map_obj.json") at the end of their code (remember this will be created in C:\Users\your_id\AppData\Local\AGKApps\your_app\media)
Make sure you copy it to your media folder
[
[1, 3, 222, 230, 30, 67, 71, 75, 123, 171, 223, 119, 175, 0, 0, 0, 0],
[4, 2, 0, 0, 0, 68, 72, 76, 124, 172, 224, 120, 176, 0, 0, 0, 0],
[0, 39, 0, 46, 47, 69, 73, 77, 125, 173, 225, 121, 177, 0, 0, 0, 0],
[0, 6, 40, 44, 45, 70, 74, 78, 126, 174, 226, 122, 178, 0, 0, 0, 0],
[41, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 115, 116, 117, 118, 0, 180, 184, 188, 192, 196, 200, 0, 0, 0, 0, 0],
[16, 167, 168, 169, 170, 0, 181, 185, 189, 193, 197, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 18, 0, 182, 186, 190, 194, 198, 0, 58, 0, 0, 0, 0],
[0, 0, 0, 0, 26, 0, 183, 187, 191, 195, 199, 0, 59, 0, 0, 0, 0],
[10, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 107, 0, 0, 0, 0, 0],
[0, 7, 43, 56, 28, 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0],
[21, 24, 37, 0, 29, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[22, 0, 5, 0, 0, 162, 0, 0, 210, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 38, 0, 0, 163, 0, 0, 211, 0, 216, 0, 0, 0, 0, 0, 0],
[0, 0, 42, 104, 0, 60, 0, 0, 212, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 33, 52, 0, 61, 0, 0, 213, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 48, 51, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 49, 50, 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, 0, 0, 0, 0, 0]
]
What i do is add the .json file as a file in my project so i can easily edit it if i need to make changes.



To load the data all you do is;
map_obj as string[]
map_obj.load("map_obj.json")

Attachments

Login to view attachments
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 16th Apr 2019 06:59
fubarpk, SFSW, blink0k thanks for the help !!
http://metamorpho-games.blogspot.ru/p/blog-page_4838.html
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Apr 2019 10:58
All the above methods work fine

but....just to add the most basic form of the solution



This can be added directly into the code as is ....or you can put it in a separate .agc file and #insert it into your main file

Login to post a reply

Server time is: 2024-11-23 01:43:24
Your offset time is: 2024-11-23 01:43:24