PERSIST SAVE BACKGROUND (demo)

1

was8bit 2019-06-28 17:08 (Edited)

Each touch will toggle between DRAW and ERASE..

When you exit, and then run this again, you’ll find your drawing saved :)

Testing.nx | Open in app
2019-06-28 17:08

CLIGUI 2025-02-17 13:59

Will this save all the points on a 32 by 32 BG?


was8bit 2025-02-17 17:08


'Load PERSIST to background
COPY $E000,$1000 TO $9000

'Save background to PERSIST
COPY $9000,$1000 TO $E000

Will load/save both BG0 and BG1 (0,0) to (31,31)

If you notice, Timo purposely made both PERSIST and Graphic memory are exactly $1000 in size... this means using this method uses ALL of available PERSIST memory to store ALL of all graphic memory

So, you cannot directly save any variables.... but IF you draw stats to the screen, you can then manually read the stats off the memory page and manually reload your stats after you have reloaded the graphics pages..

$800 only saves one BG but i forget which one... so it is possible to only use half the PERSIST memory for one background, and the other half of PERSIST for variables, but you will need to figure out how that will work..

I have used the "read stats manually" .... and i have also used a hidden BG layer to store enemy levels under where each enemy was (but moving the level# to match enemy position was abit tedious)

.... lots of options ;)



CLIGUI 2025-02-17 20:58

Thanks for the information. I ask because I do need to save every cell on two 32 by 32 backgrounds, one for a map and another for an inventory system.

But I am having a creative block on how to switch from one to another. Here it is if you are curious.

2D Land 0.2.nx | Open in app
2025-02-17 20:58

CLIGUI 2025-02-17 22:26 (Edited)

Ok I think I got it with this program

It has an inventory system and it saves what you build!



Use pause to open and close the inventory

Cell Garden.nx | Open in app
2025-02-17 22:26

Log in to reply.