Discuss Scratch

HamsterLord456
Scratcher
2 posts

Need Help With Clones

Hello everybody!
I'm making a project where I have a hamster that walks around, needs to eat and drink in it's environment, etc. This is going to be a simulation-type project so I will probably need to have dozens of these guys around, also being able to spawn in at certain times. I'm not bothered to make each hamster individually with its own Hunger, Water and Sleep variables, so I've tried using the Clone feature, where a sprite can make a duplicate of itself. This works well, especially since I can have as much hamsters as I want without any grindy work, but the problem is that all clones share the same Hunger variable as eachother and the original, and I need them so somehow have their individual variables for this to work. Any ideas on how I can have each clone have it's own variables, or another way around this problem? Thanks!
zksoon1
Scratcher
67 posts

Need Help With Clones

To do this, use the “only for this sprite” option when you make a variable.
MonstrousFlightmare
Scratcher
42 posts

Need Help With Clones

To my knowledge, I don't believe there is a way on scratch to give clones their own specific variables. The only work around I can think of would be to duplicate your hamster and make completely separate variables for each of them, but that's extremely tedious and inefficient. Sorry!
zksoon1
Scratcher
67 posts

Need Help With Clones

MonstrousFlightmare wrote:

To my knowledge, I don't believe there is a way on scratch to give clones their own specific variables. The only work around I can think of would be to duplicate your hamster and make completely separate variables for each of them, but that's extremely tedious and inefficient. Sorry!
It is possible, use the “this sprite only” option when making a variable.
michaeljackson1365
Scratcher
500+ posts

Need Help With Clones

There is a workaround without duplicating the hamster sprite, just make them robots except when they need to eat they go to the nearest food place, but will often go to the master food sprite. If they need to drink, they can just go to the place where they will drink, however they will drink in the same spot. However, you can use variables and clones so they can drink at the latest drinkable spot. Just… yeah.

In my signature:
THREE BIG GUYS… however the words lead to a different project of mine.
Three=Comic Unknown Civilization Battle (added a cloud multiplayer thing but it only works on turbowarp)
Big=Dragonhead Colonizing Terror (I STILL HAVEN'T FIGURED OUT WHY THE POLLUTED AREA DOESN'T DISAPPEAR)
Guys=Comics Earth Planets - Orbit Sim (my flagship project ❤️❤️)
HamsterLord456
Scratcher
2 posts

Need Help With Clones

OK, thanks everybody! I will try some of these ideas out! Also zksoon1 the clone still shares the original's sprite-only variable, so sadly that won't work!
deck26
Scratcher
1000+ posts

Need Help With Clones

HamsterLord456 wrote:

OK, thanks everybody! I will try some of these ideas out! Also zksoon1 the clone still shares the original's sprite-only variable, so sadly that won't work!
What do you mean? If it's a sprite-only variable the clone gets its own copy.
zksoon1
Scratcher
67 posts

Need Help With Clones

HamsterLord456 wrote:

OK, thanks everybody! I will try some of these ideas out! Also zksoon1 the clone still shares the original's sprite-only variable, so sadly that won't work!
when the clone is made, it gets its own copy, check here.

Powered by DjangoBB