Log In  

Say a player has a way to design a custom painting in a game. This painting should persist between playthroughs, and be stored on the spritesheet.

I know that this should be done via cstore(), but I simply do not understand how.

function painting()
  -- code for modifying sheet through sset() here --
  cstore(A,A,L)
end

What I actually need is the values for A and L.
Cheers in advance.

P#95272 2021-07-25 16:51 ( Edited 2021-07-25 16:59)

From the manual (https://www.lexaloffle.com/dl/docs/pico-8_manual.html#CSTORE), the parameters are destination address, source address and length.

So to copy the screen data into the spritesheet, we need to find their addresses using https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Memoryhttps://www.lexaloffle.com/dl/docs/pico-8_manual.html#CSTORE : spritesheet address starts at 0x0, screen data is at 0x6000, and it takes 8k which is 8192 bytes for the length param!

Make sure to copy your cart before you try this.

P#95284 2021-07-25 18:51

(I realize that the comment in your code says that you'll use 'sset' to store design in spritesheet, whereas my message assumes 'pset' is used to draw on screen directly. Adapt my answer as needed!)

P#95285 2021-07-25 18:53

@merwok Thanks!

P#95286 2021-07-25 19:28

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 10:25:40 | 0.017s | Q:14