editor - (Processing) How to write in a specific position in a file -


i'm trying learn programming, , i'm bit lost right ! i'd create bomberman, lever editor, though don't know how level editor. how work : save level in file (i start filling file 0's) i've got 20 per 20 map, when left click : block change in either : nothing(0), normal block(1), or invicible block(2), , . loop print these on screen. problem couldn't find way write in right spot of file. (like if click on 3rd block of 2nd line, 43rd number change either 1,2 or 3). hope understood question :) !

don't try write specific place in file. instead, write whole file out again, whatever changes you've made.

step 1: read file in set of data structures. in case, 2d array reasonable option represent grid.

step 2: use data structures display program. modify data structures change what's displayed. example, changing cell in 2d array might change type of block in position.

step 3: write out data structures file whenever want save them. note don't bother trying write out specific character. write out whole file again.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -