Discuss Scratch

BlueBionicWhale
Scratcher
61 posts

Shortening Scripts

Link to project: https://scratch.mit.edu/projects/544717742/
Is there a way to shorten the scripts in sprites ‘Food Smasher!! Title Screen Continue Button’ and ‘Food Smasher!! Title Screen New Game Button’?
Yusei-Fudo
Scratcher
1000+ posts

Shortening Scripts

Of course! That's all I can think of off the top of my head.

“Food Smasher!! Title Screen” Sprite
Before:


After:


Decrease block count by 2
BlueBionicWhale
Scratcher
61 posts

Shortening Scripts

Yusei-Fudo wrote:

Of course! That's all I can think of off the top of my head.

“Food Smasher!! Title Screen” Sprite
Before:


After:


Decrease block count by 2

Thank you! This has actually stopped some of the lag in my project!
Yusei-Fudo
Scratcher
1000+ posts

Shortening Scripts

BlueBionicWhale wrote:

Yusei-Fudo wrote:

Of course! That's all I can think of off the top of my head.

“Food Smasher!! Title Screen” Sprite
Before:


After:


Decrease block count by 2

Thank you! This has actually stopped some of the lag in my project!

han614698
Scratcher
1000+ posts

Shortening Scripts

You should almost never have two of the same hat block in one sprite.
In the backdrop, you should always have a
in each sprite.

I don't see any obvious mistakes in this projects.
BlueBionicWhale
Scratcher
61 posts

Shortening Scripts

han614698 wrote:

You should almost never have two of the same hat block in one sprite.
In the backdrop, you should always have a
in each sprite.

I don't see any obvious mistakes in this projects.

han614698 wrote:

You should almost never have two of the same hat block in one sprite.
In the backdrop, you should always have a
in each sprite.

I don't see any obvious mistakes in this projects.

Ok, thank you!
Theo_1er
Scratcher
500+ posts

Shortening Scripts

Remix. I shortened the script in the first sprite and I deleted not usefull sprites and costumes in the second one, however it makes the script a little more complicated.
Oumuamua
Scratcher
1000+ posts

Shortening Scripts

TBH I think you are wrong and you should try to figure more efficient scripts instead; shorten does not mean better always.
Greets.
Yusei-Fudo
Scratcher
1000+ posts

Shortening Scripts

Oumuamua wrote:

TBH I think you are wrong and you should try to figure more efficient scripts instead; shorten does not mean better always.
Greets.

Agreed
EpicGhoul993
Scratcher
1000+ posts

Shortening Scripts

Yusei-Fudo wrote:

Of course! That's all I can think of off the top of my head.

“Food Smasher!! Title Screen” Sprite
Before:


After:


Decrease block count by 2
It will malfunction if the costume number changes.
mmnagelia
Scratcher
100+ posts

Shortening Scripts

Yusei-Fudo wrote:

Of course! That's all I can think of off the top of my head.

“Food Smasher!! Title Screen” Sprite
Before:


After:


Decrease block count by 2
This is even better:

when green flag clicked
forever
if <<(costume #) = [7]> or <(costume #) = [17]>> then
play sound [mixkit-martial-arts-fast-punch-2047 update v] until done
end
end
Thingied
Scratcher
1000+ posts

Shortening Scripts

mmnagelia wrote:

Yusei-Fudo wrote:

Of course! That's all I can think of off the top of my head.

“Food Smasher!! Title Screen” Sprite
Before:
-snip-

After:
-snip-

Decrease block count by 2
This is even better:

when green flag clicked
forever
if <<(costume #) = [7]> or <(costume #) = [17]>> then
play sound [mixkit-martial-arts-fast-punch-2047 update v] until done
end
end
Even better one:
when green flag clicked
forever
wait until<<(costume #) = [7]> or <(costume #) = [17]>>
play sound [mixkit-martial-arts-fast-punch-2047 update v] until done
end
Shortening scripts makes things harder to work with so I would just make scripts flexible.

Last edited by Thingied (June 18, 2021 17:20:53)

Theo_1er
Scratcher
500+ posts

Shortening Scripts

It's funny to see so many people trying to find the most efficient script in the “title screen” sprite while the OP asked for the “continue button” and “new game button” sprites.
EpicGhoul993
Scratcher
1000+ posts

Shortening Scripts

Theo_1er wrote:

It's funny to see so many people trying to find the most efficient script in the “title screen” sprite while the OP asked for the “continue button” and “new game button” sprites.
Ikr.

Powered by DjangoBB