Discuss Scratch

SchoolAccount854672
Scratcher
23 posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

Hello everyone! I've been following Griffpatch's tile scrolling platformer tutorial, and I followed along with the code, here are my saving and loading scripts:
Note: I changed level # to level num in the save block to make sure I don't accidentally put the save level # in the load level #, I have 32 costumes in tiles, if that matters and I haven't continued past this part yet, in order to not break anything.

Here is the saving script:

defineSaveLevellevelnumsetencodedtoWriteValue:1Delimiter:_WriteValue:GRIDWIDTHDelimiter:_WriteValue:GRIDHEIGHTDelimiter:_settileindexto1settiletoitemtileindexofTILE GRIDsetlengthto0repeatGRIDHEIGHTrepeatGRIDWIDTHiflength<26andtile=itemtileindexofTILE GRIDthenchangelengthby1elseiftile=2thensettiletoWriteValue:tileDelimiter:itemlengthofa to zsettiletoitemtileindexofTILE GRIDsetlengthto1changetileindexbyGRIDHEIGHTchangetileindexby1-GRIDWIDTH*GRIDHEIGHTWriteValue:lengthDelimiter:_repeatlevelnum-lengthoflevel storeaddtolevel storereplaceitemlevelnumoflevel storewithencoded

Here is the write value script:

defineWriteValue:valueDelimiter:lettersetencodedtojoinencodedjoinvalueletter

Here is the loading script:

defineLoadLevellevel#setencodedtoitemlevel#oflevel storesetreadindexto1ReadValueifnotvalue=1thenstopthis scriptdeleteallofTILE GRIDReadValuesetGRIDWIDTHtovalueReadValuesetGRIDHEIGHTtovaluerepeatGRIDWIDTH*GRIDHEIGHTaddtoTILEGRIDsettileindexto1repeatuntilreadindex>lengthofencodedReadValueifvalue=thensetvalueto2repeatitem#ofletterina to zreplaceitemtileindexofTILE GRIDwithvaluechangetileindexbyGRIDHEIGHTiftileindex>GRIDWIDTH*GRIDHEIGHTthenchangetileindexby1-GRIDWIDTH*GRIDHEIGHT

Here is the Read Letter script:

defineReadLettersetlettertoletterreadindexofencodedchangereadindexby1

Here is the Read Value script:

defineReadValuesetvaluetoReadLetterrepeatuntilletter>9orletter=setvaluetojoinvalueletterReadLetter

Thanks, and also please check other answers so you don't accidentally copy anyone else's post. Thank you!

Last edited by SchoolAccount854672 (April 7, 2021 13:41:30)

CST1229
Scratcher
1000+ posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

To change block color, you can put “:: color” after the block.
write value [sb] delimiter: [_] :: custom
writevaluesbdelimiter:_
SchoolAccount854672
Scratcher
23 posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

CST1229 wrote:

To change block color, you can put “:: color” after the block.
write value [sb] delimiter: [_] :: custom
writevaluesbdelimiter:_
Thanks!
ScriptTimedOut
Scratcher
100+ posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

Do you have a question?

If not, then please look at this statement by Paddle2See about guides and why they can't be made right now.
SchoolAccount854672
Scratcher
23 posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

ScriptTimedOut wrote:

Do you have a question?

If not, then please look at this statement by Paddle2See about guides and why they can't be made right now.

I don't really have a question, however, because this script isn't working, and I can't find out why it's not working, even after rewatching the tutorial and looking at other projects, I've decided to ask here on the HwS forum. (Sorry if that might've come off as me being offended or offensive because of all the commas )
SchoolAccount854672
Scratcher
23 posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

ScriptTimedOut wrote:

Do you have a question?

If not, then please look at this statement by Paddle2See about guides and why they can't be made right now.
Actually, I think I get what you mean now. No, this is not a guide. My script isn't working the way it's intended to and I'm asking for help to try and fix it. My problem is that when the block saves and then loads, it doesn't look like the original level.
aofan2009
Scratcher
67 posts

Griffpatch's Tile Scrolling Platformer Tutorial (Saving & Loading)

@SchoolAccount854672 Can you please post Part 1 of Griffpatch's Tile Scrolling Tutorial? Please?

Powered by DjangoBB