The Variable HACK 🔨 Not many Scratchers know... yet

preview_player
Показать описание
Quickly fix the most annoying of Scratch problems with this super easy variable hack! We've all made this mistake while coding in Scratch; Created a variable "For All Sprites" that should have been "For This Sprite Only". In this video we'll learn what the problem is, and some crazy cool ways to fix it and the underlying bugs it causes!

Also, enjoy my Griffpatch Story time lol - Hope you appreciate the rhyme!

My tutorials are for all budding game & software developers using Code Blocks. Scratch On guys!

🚀 *Boost Your Creativity with Griffpatch*
The Griffpatch Academy will take you from "Gamer to Game Creator"

--------------Video Chapters--------------
0:00 Intro
0:18 The Problem
2:07 Debug
3:53 Try to Fix
4:42 Attempt 1
5:29 Solution 1 - Variable Hack
6:59 Any problems?
7:37 Solution 2 - Hard Work
7:53 Solution 3 - Scratch Addons
9:48 Outro
Рекомендации по теме
Комментарии
Автор

For those who are interested, Scratch Add-ons does provide a switch option between "for all sprites" and "for this sprite only", BUT it currently only works if you are not using the variable in multiple sprites... Which was the point of this video. Hopefully in future that will be fixed and then this will become super easy!

griffpatch
Автор

*Poems by Griffpatch*
0:20
Once upon a time, Griffpatch feeling so clever, began to code the most epic Scratch project ever.
0:28
It began with a cat, and a variable for health. But should it be for all sprites,
0:34
or only for itself? Well, he wasn’t quite sure,
0:39
so he just let it be, and continued on blindly, saying “I guess we’ll just see”.
0:45
Then, when green flag clicked, Still unaware of his bloop, he set health to 5,
0:50
then straight into a forever loop. But just to be sure, he muttered “A say
0:56
block won’t lag”, he dropped in the health variable, and smashed that green flag!
1:02
“5” he declared, “Such muscle, such brawn!”, but he did not dally, no he had to Scratch On!
1:10
And so, with much health, Scratchy was ready to fight, with a nimble right click,
1:15
Griff duplicated that sprite. And it looked to be working,
1:19
double avatars of Scratch, reporting 5 health a peace, a genuine perfect match.
1:26
"Now it’s time to mix it up… " Griffpatch declared, and then,
1:30
boosted one cat's heath from 5 up to 10. And that's when it happened, on clicking
1:36
the green flag, it become pretty obvious he'd just hit a big snag.
1:42
For-although each cat's health was, there to plainly see,
1:46
they both still were reporting the very same exact HP.
1:50
But how is this possible? Each sprite's health was individually set, to a completely
1:55
different value when green flag clicked, and yet… "Oh man, this is bad", he disliked code Rewrites,
2:03
"I bet this was all because I opted for "for all sprites".

mdewknp
Автор

Some of my favorite addons:
• Separate “for all sprites” and “for this sprite only”
• Enhanced fullscreen
• Various addons that let one change the editor look

waytoobiased
Автор

Been using this for a while and it’s been an absolute lifesaver!

Another useful variable add on is one to separate the ‘all sprites’ ones from the ‘this sprite only’ ones in the toolbox :)

itsplatinum
Автор

You know, that preview mistake where all the enemies jump as you jump could make for quite a fun and interesting game.

lasercatto
Автор

The style of this video from 0:00 to 2:05 is just hilarious!

jeditz
Автор

Don’t know if you’ll ever see this but your scratch games and well the scratch community got me into programming way back when. I just landed a swe job as a new grad at a faang company and wanted to thank you!

imara
Автор

Thanks griffpatch we can never have doubted because you never fail to make the scratch community a better place

CMM
Автор

It was also interesting learning a bit about how Scratch handles missing variables, too. Now I'm really curious the specific logic they use to do that, but that somehow gets (I'm assuming) the "first sprite you click on that needs the replacement" stuck in the reporter. If you hadn't proved it worked, I would have suspected a bug where they had a new global but with the sprite name prefix in it accidentally or something like that. Hmm...

Resseguie
Автор

I don’t even use scratch but still watch these.

They’re super well made and interesting! Keep it up!

Cr_nch
Автор

Scratch addons is finally getting the recognition it deserves! I use this extension all the time and I feel so happy you're announcing it!

hypedanceemoteD
Автор

I must say, the amount of editing you putting into these is a lot of work! Especially the mouse clicking sounds 😉 I know your tricks

hazard
Автор

I love the rhyming XDDDD
I have experienced this 'for all sprites variable thing' before with making hp in multiple clones. It was so odd because a clone with a small hp drops in it would mean all clones will go to low hp aswell. And i was very working back then so i just went with it till this day its still here. I noticed when i decided to recreate my old proojects and make everything better. I realised it wasnt happening again and that openes up much more possible ways to make games on scratch. The old days...

luigipunchanimation
Автор

You can also use a "for this sprite only" variable to have *clones* have individual values for variables. Just something to keep in mind.

mightty
Автор

I can tell Griffpatch's editing got better and funnier

Keep it up!

RonicTheEgg
Автор

was not expecting the poem at the beginning.

Arch-bxwz
Автор

Thanks griffpatch!
I once also thought i know all about scratch variables and got so puzzled when the project didn't work as i intended. This is an absolute life saver!

GBA
Автор

Nice one, in the beginning I was kind of hoping the whole episode would be in poem form
This trick might come in handy in future Scratch teaching sessions! Although I think I'll still get the most minds blown with the most underrated/misunderstood block of all: ([backdrop# v] of (Stage v)). ...whose secret power I learned from one of your videos obviously.

milankarow
Автор

Exhilarated to see more of these add-ons. Lets go! Sure would love to see more in the upcoming videos in the form of a poem :D

pahalvaidya
Автор

Super useful. I was having a problem with my item variables and set them to "for this sprite only" when they should've been "for all sprites", without this I would have had to rewrite everything, and now that I've watched it I was able to fix my problem with ease. I'm sure this video will be a big influence for others with a similar problem.

miklhnsn