Scratch Clones and Local Variables Tutorial

Поделиться
HTML-код
  • Опубликовано: 11 июл 2024
  • How’s your Scratch clones game going? Are you using local variables to sense individual clones? If not, then check out this tutorial that shows you some more advanced clone usage that uses local variables. Educators, get news and resources sent straight to your inbox here: bit.ly/SurfSubscribe
    --------------------------------------------------------------------------------------------------------------------------------
    🔗🔗🔗 LINKS 🔗🔗🔗
    👕👚TEE I’M WEARING - : shrsl.com/23v8q
    ➡️Scratch Clones: en.scratch-wiki.info/wiki/Clo...
    ➡️Advanced Scratch Clones: en.scratch-wiki.info/wiki/Adv...
    ➡️Scratch Project: scratch.mit.edu/projects/3652...
    --------------------------------------------------------------------------------------------------------------------------------
    🙏🙏🙏 SUPPORT 🙏🙏🙏
    ➡️PATREON: / surfingscratcher
    ➡️MAILING LIST: bit.ly/SurfSubscribe
    Surfing Scratcher receives a percentage of the purchase price when you make a purchase through some of these links.
    --------------------------------------------------------------------------------------------------------------------------------
    🛒🛒🛒SHOP 🛒🛒🛒
    Educators and teachers, you can find unplugged lessons, resources and activities to purchase for this tutorial series on my website here:
    ➡️Educational Resources: www.surfingscratcher.com/shop/
    ➡️Browse my Teachers Pay Teachers Store: bit.ly/2Tq45lH
    --------------------------------------------------------------------------------------------------------------------------------
    👻👻👻 SOCIAL MEDIA 👻👻👻
    ➡️Scratch: scratch.mit.edu/users/surfing...
    ➡️Website: surfingscratcher.com
    ➡️Like my Facebook Page: bit.ly/2HnR1Gg
    ➡️Subscribe to my RUclips Channel: bit.ly/2TDtqI3
    ➡️Follow me on Instagram: bit.ly/2NWlxZe
    ➡️Follow me on Pinterest: bit.ly/2CdKIl5
    --------------------------------------------------------------------------------------------------------------------------------
    📝📝📝 VIDEO DESCRIPTION 📝📝📝
    In this tutorial, we’ll use a basic turret gun game to demonstrate some advanced clone usage. We want to be able to sense individual clones when they are created. In order to do that, we must use local variables in Scratch.
    Local variables create a copy of a sprite’s variable for the individual clone. That’s so the clone has its own independent version. Think of it like the main sprite is Mum or Dad and the clone is a child. The name of the variable is like our last name. That’s usually what is the same between you and your parents. Your first name is what is unique to you.
    When we use local variables, we can sense individual clones and their values.
    --------------------------------------------------------------------------------------------------------------------------------
    ❓🤔❓ WHAT IS SURFING SCRATCHER? ❓🤔❓
    Surfing Scratcher wants to show learners, students, educators and teachers how to learn mathematics through coding games online with Scratch 3 programming projects. Whether you are a Scratch beginner, or you're an educator wondering how to use Scratch in your classroom or looking for lessons & resources for your classroom, Surfing Scratcher is here to help you on your journey.
    --------------------------------------------------------------------------------------------------------------------------------
    ⏯ ⏯⏯PLAYLISTS ⏯ ⏯⏯
    bit.ly/2J1q5i3
    --------------------------------------------------------------------------------------------------------------------------------
    #scratch #scratchtutorials #howtocode

Комментарии • 168

  • @SurfingScratcher
    @SurfingScratcher  4 года назад +25

    SCRATCHY QUESTION: What is one reason why you might use local variables with clones?

    • @kastmepoiss135
      @kastmepoiss135 4 года назад +9

      i'm creating a project where you need to detect clones by the actions, imma use that localID for in-script detection

    • @tonypatino1765
      @tonypatino1765 4 года назад +2

      For commonly used variables like "i" ;D

    • @richardlow2947
      @richardlow2947 4 года назад

      I am trying to make electric field arrows do different things (depending on their distance and direction from charges)

    • @SurfingScratcher
      @SurfingScratcher  3 года назад

      @Spectral Penguin Check out my video on health bars: ruclips.net/video/fm9QJ9yk1jw/видео.html
      You should be able to use a local variable for the 'life' of each enemy. You could also clone the healthbar and peg it to the position of your clones, but you'll probs need to store xy locations in a list to help you out. A big task, but doable!

    • @joshuachan6317
      @joshuachan6317 3 года назад

      For making the multiple enemy as a clone with its local variable store as it’s health. So your tutorial really helps me out a lot! Thx bro

  • @chetanys6920
    @chetanys6920 2 года назад +7

    i was making a space shooting game and the clone of the laser i had made had a variable named health and wanted to decrease the number of the variable when the clone of the laser touched that sprite and this helped me a lot in that game, thanks for the video.

  • @influxxmedia
    @influxxmedia 3 года назад +5

    FANTASTIC! Exactly the answer I was looking for. I'm creating a bubble particle system, where a bubble sprite is cloned, then each clone floats up at random speed until they reach a certain point when they pop. At this point I wanted to delete the clone and reset, having a new clone respawn and begin its cycle again. Each time the respawned clone ended up duplicating all 15 bubbles in the system. Agh. This global/local var technique will help me fix that. Awesome, thanks! Hope you caught that wave. Cheers dude.

  • @CatsAreAwesome146
    @CatsAreAwesome146 Месяц назад

    Yo thanks! This tutorial didn't just teach me how to do a specific thing it actually made me understand the concept. I never knew that local variables actually did that for clones as, and the fact that you explained the fact that it will say 1,2,4,8 and stopped that pitfall was a huge help. Using this tutorial I was able to make something almost entirely different than the showcased example, and thats a testament to how good a job it does teaching fundamentals!

  • @mrg4melover
    @mrg4melover 3 года назад +5

    I’m working on an Undertale-inspired game with blasters (multiple may be on screen at once, so the blasters themselves had to be clones). I used a local variable to determine whether the clone was the blaster (shooter) or the blast (bullet, to some extent??), and depending on what the variable is, it behaves either like a blaster or a blast. This video really helped me, thanks!

  • @mayorhotdog2799
    @mayorhotdog2799 3 года назад

    Great video, it really helped me out with my script, thank you.

  • @timsuperovsky
    @timsuperovsky Год назад

    Thank you wery much, for a MONTHS ive been thinking how to give clones names. And now i know how.

  • @michaelklein6244
    @michaelklein6244 2 года назад

    Really cool, this enhances my understanding and shows me how little I know. Amazing stuff!!!

    • @SurfingScratcher
      @SurfingScratcher  2 года назад

      Good on you for checking it out and expanding what you know:)

  • @user-xu9ep7xn4i
    @user-xu9ep7xn4i 2 года назад

    It's very helpful for me to develop my first scratch project. Thank you for your video.

  • @twalton
    @twalton 2 года назад

    This helped me SO MUCH. Thank you!

  • @SunsetDragon
    @SunsetDragon 2 года назад +1

    Thank you so much for this video!! It helped a lot, and wasn't one of those six-hundred-million-hour-long tutorials you see all the time! Ha!
    This helped A LOT with my Paranoid Animation Meme, which I'm still working on as of now, but I'm done with the intro!
    In the intro I had to have FOUR CLONES all doing different things. I always wondered how to do this!! This is going to help a LOT with so many other things, such as animations with a limit of one sprite, and even more animation and code memes!
    Thank you again!
    ~Sunset

    • @SurfingScratcher
      @SurfingScratcher  2 года назад +1

      Awesome, thanks for sharing your experience Sunset. Loved reading it :)

    • @SunsetDragon
      @SunsetDragon 2 года назад

      @@SurfingScratcher Thank you for the tutorial! :D

  • @wendizhoumdphd4627
    @wendizhoumdphd4627 4 года назад +3

    Great content. Please keep it up.

  • @oualidbazzaoui1989
    @oualidbazzaoui1989 Год назад +1

    tysm, i was making a card game and this helped me so much mostly specific clones!

  • @ajtopia
    @ajtopia 2 года назад

    AHHH ITS SO SIMPLE AS TO JUST MAKING IT FOR THAT SPRITE ONLY!!!!! THANK YOU SMMM

  • @dockpirate2127
    @dockpirate2127 3 года назад +5

    omg I'm so stupid, I've been trying to find a way to make a clone visible while the original sprite still stays hidden thank u so much

  • @theverybest4184
    @theverybest4184 3 года назад

    thank you so much this helped me a lot

  • @nguyenquangdung9892
    @nguyenquangdung9892 3 года назад +2

    Nah, this awesome channel surely deserves more views, likes, shares & subs. Unfortunately I dont have any friends who are into Scratch and the programming stuffs like me :'(

  • @mxstermajoraktas4454
    @mxstermajoraktas4454 3 года назад +3

    the video helps me for a game thx

  • @dockpirate2127
    @dockpirate2127 3 года назад +1

    Thank you so much! I just found out how to make a path generator with this :)

  • @fidelisalberto6226
    @fidelisalberto6226 3 года назад +1

    Seus vídeos são excelentes..OBRIGADOOO

  • @tdog_
    @tdog_ 2 года назад

    this is helping my water physics engine thank you so much!

  • @bcs2971
    @bcs2971 6 месяцев назад

    Thank you so much! I had a problem where the clone button cloned all of them. So glad to understand why and understand how to overcome that problem.

  • @WUJCIX
    @WUJCIX 9 месяцев назад

    THank You so much you very helped me

  • @user-kb9og3yr7u
    @user-kb9og3yr7u 8 месяцев назад

    thanks man, you saved me, im making an ANT simulation but i didnt know how to refere to a specific ant of the colonyK

  • @R0DBS
    @R0DBS 5 месяцев назад

    Thanks mate!

  • @larryc324
    @larryc324 2 года назад

    Very helpful

  • @Jellyjam14blas
    @Jellyjam14blas 4 года назад +3

    Thank you! I been trying to figure out how to do this for so long. ❤️

    • @SurfingScratcher
      @SurfingScratcher  4 года назад

      Boom jellyjam14blas! Thanks for dropping your comment. I'm pumped to hear you found value in the video. Keep your code on 😎

  • @tyguy104
    @tyguy104 Год назад +1

    Essential for trying to build a city maker or simulator game. Where when you place houses down and I want to program the sim going to his job with a car. So the houses are clones. And I figured out, how the list will record a spawn. It can record the clone's x and y positions and you can make it wait for 10 seconds until it does record the value if you need a lot of time. Then i'll try to make the car clone come out of that x and y position that was recorded for the house clone's x and y coordinate. Ultimately trying to get to an industry's or commercial's x and y. All the properties are either R, C or I (or just 3 different) types of clones. How Sim City would divide it's zones.

  • @childofflesh1591
    @childofflesh1591 2 года назад

    Hi, I’m working on a game where I want to be able to create clones that are sort of magnetic and move towards each other. Can you help with how the code to make clones move towards each other might work?

  • @rogercounts
    @rogercounts Месяц назад

    I was having trouble that the isClone? Fixed. Tbh I do not understand how that fixes my problem but thanks a ton. I tried (here and there) for hours to figure out the solution for my tycoon and it was here the whole time

  • @leofeld9511
    @leofeld9511 3 года назад

    I am making a paddle and ball game like scratch tutorial. I want to make another ball appear once the score reaches a certain number. Can I do this with clones? Or would I need to create another sprite?

  • @madamebunbun3479
    @madamebunbun3479 Месяц назад

    Thanks, I've been making a silly game on scratch and got stuck with cloning issues

  • @damrus312
    @damrus312 2 года назад

    can you help me please. why bulletld (for this sprite only) not show when (set bulletld to globalld). thank you

  • @vtcomics365
    @vtcomics365 Год назад

    you are so cool!!

  • @crazyseth4099
    @crazyseth4099 3 года назад +1

    how do you hide the sprite but show the clones?

  • @dragondg6412
    @dragondg6412 2 года назад

    How do i make clone point to other clone if they are enough close to each other

  • @davidliu2243
    @davidliu2243 3 года назад

    I need to replace objectives in lists with the local variable of clones but it doesn't seem to work. Why is this?

  • @gavinmann4152
    @gavinmann4152 4 года назад +1

    Thanks soooo much. i was using just a bulletID which was global, so you can only use that variable at the INSTANT the clone is created, but with this i can use the local variable for the clone later on in the script and not have it interfere with the other clones. Maybe i'll link the project when i'm done if that's ok - it's simulating an ecosystem.
    Your videos are the best - they are clear and they are so professional looking, Happy Scratching!! :)

    • @SurfingScratcher
      @SurfingScratcher  4 года назад +1

      Awesome, Gavin! So pumped to hear that you found some value in the video and thanks for the supportive feedback :)

  • @Bryan-dc7pb
    @Bryan-dc7pb 3 года назад +1

    maybe i be late but i wanna know if clones can interac with other clones (from other sprites)

    • @SurfingScratcher
      @SurfingScratcher  3 года назад +4

      Hi Bryan, thanks for your question. Short answer is yes. All the sensing blocks are still available (if touching other sprite). If you want to detet a specific sprite, that's where you'll need to check with IDs.
      If you broadcast an event, then every clone will receive it. If you want a specific clone to receive it, again, you'll need to use the ID method that's covered int he video.
      Let me now if that clears it up, or if it's something else you're wanting to do.

  • @kingvax064
    @kingvax064 Год назад +2

    I have been stuck with a problem for a while. Can you make a sprite go towards the closest clone of another sprite?

    • @SurfingScratcher
      @SurfingScratcher  Год назад +1

      Yeah you should be able to. The trick is to keep track of all the clones using local variables. You'll have to loop through all the clones and get the x and y coordinates and check to see which is the closest to the sprite you're interested in.

    • @kingvax064
      @kingvax064 Год назад

      @@SurfingScratcher Thank you very much! I ended up just making three different sprites instead of clones of the same one, but I'll use this technique if I want to expand the project.

  • @trishSilly
    @trishSilly Год назад

    is there a way for clones, to have clones for themselves ?
    like a clone all to themselves with their own properties

  • @GuiDuckz
    @GuiDuckz 3 года назад +4

    I have a question thats gonna really help me out
    I wanna do a sprite that points to the closest clone.

    • @SurfingScratcher
      @SurfingScratcher  3 года назад

      Great question! You'll need to track the x and y positions of clones in a list so that you can check to see which is the closest.
      You're not gonna be able to point in the direction of that clone using a built-in block. Instead, you'll need to use trigonometry based on the x and y coordinate that you've got from your list.
      Thankfully, I've just done a whole series on trig. Check out this video, it'll give you some clues: ruclips.net/video/kxRywPEUfcc/видео.html

    • @masak1gang419
      @masak1gang419 3 года назад

      @@SurfingScratcher That's really hard but. I JUST SPENT 4 WHOLE DAYS TO FIND THAT ANSWER. MASSIVE THANKS!!!!!

  • @shaileshkarnawat1983
    @shaileshkarnawat1983 3 года назад +1

    I all unable to make that man pls help the bullets attend visible, they aren't moving... Pls help

  • @jaelhierso6141
    @jaelhierso6141 Год назад

    hello, i would like to make clones with differents script and differents costumes in one sprite. How can i do that plz ?

  • @breadisyummy_
    @breadisyummy_ 2 года назад

    im making an evolution simulator, but i cant figure out how to make the animal go towards the closest food clone

  • @Mutatedordinary
    @Mutatedordinary 4 года назад +1

    Really diggin’ that t-shirt, it is a really creative design!

  • @ShineOrSomething
    @ShineOrSomething 3 года назад +2

    my game goes smoothly and the bullet works fine but when you play for like a minute the bullet and my enemy stops making clones suddenly, do you know how to fix this? pls help

    • @SurfingScratcher
      @SurfingScratcher  3 года назад +2

      Hmm check that your clones aren't making clones. Scratch has a limit of around 300 clones, so you could have maxed out. That bug is demonstrated and fixed in the video. How can you check this? Count the number of clones you have on the screen and use the 'say' block to print its id number. They should match.

    • @ShineOrSomething
      @ShineOrSomething 3 года назад +1

      @@SurfingScratcher neva mine sorry i just forgot to use the "delete this clone" block and it kept on maxing out because i didnt delete any clones. Thx

  • @NamHoang-oy7lj
    @NamHoang-oy7lj 2 года назад

    How can you make the clone not overlapping on each other?

  • @SmartWittyName
    @SmartWittyName 3 года назад

    How would you then transfer the value of the local variable back to a new global one? For example, when you click on a specific bullet, a new variable is assigned the number of that bullet? When I try to do this by "set (variable) to bulletid" it doesn't choose a clone, it assigns 0, just as bulletid is listed at the top of your screen.

    • @SurfingScratcher
      @SurfingScratcher  3 года назад +1

      Hi SmartWittyName, thanks for your comment. In the video, we use a globalID, change it by 1, then make it the value of the localID. If you want to go the reverse, then just set the other global variable to the value of bulletID in the sprite clicked hat block. You've just gotta be sure that you've already set bulletID. Read the value of bulletID first and be sure that it's not already 0, if it is, you have a bug somewhere!

    • @SmartWittyName
      @SmartWittyName 3 года назад

      @@SurfingScratcher Thanks so much for replying! I found the bug - I had a different trigger for cloning in the script of another sprite, originally to prevent myself from cloning clones. After rearranging some things to use the isClone variable you showed in the video, it worked perfectly =)

  • @DeadliestBlox
    @DeadliestBlox 2 года назад

    I'm trying to make a button where it hides everything by using a broadcast, but I don't know how to hide the clones, can anyone help me? I can't find answers in this video.

  • @Goldtalysis
    @Goldtalysis 3 года назад

    hello! i know im really late, but i have a problem and idk how to fix it. so, i have been creating a fnf game in scratch, and im actually coding the notes, now, here is where the problem begins, i use clones and messages for the notes (e.x : send (left)) and when the left note recieves left, then it will show as a clone and it will move up, however, if i create too much clones, they just dont appear, they wont. i tried restarting scratch, remaking the game from 0, everything. it still happens, can you please help me? i got so excited to start with this game, and go so sad when i saw this problem.

    • @SurfingScratcher
      @SurfingScratcher  3 года назад

      Scratch has a 300 clone limit, so you won't be able to generate more clones if you've reached that limit. You'll need to delete clones before creating new ones. See if that helps your problem!

    • @Goldtalysis
      @Goldtalysis 3 года назад

      @@SurfingScratcher thanks! I will try that later

  • @Ac3ofspad3s-cp6wp
    @Ac3ofspad3s-cp6wp 9 месяцев назад

    HELLO WORLD I am super late to this amazing video... I was making a battle cats not really a knockoff on scratch when I thought how to make clones die one at a time? thanks for the video helped me a lot

    • @SurfingScratcher
      @SurfingScratcher  9 месяцев назад

      Thanks for sharing your experience :)

    • @Ac3ofspad3s-cp6wp
      @Ac3ofspad3s-cp6wp 9 месяцев назад

      @@SurfingScratcher no problem this is such a good tutorial!

  • @celsladroma8048
    @celsladroma8048 8 месяцев назад

    I HAVE VERY IMPORTANT QUESTION WHY I CANNOT DELETE ONE OF MY CLONE IN SCRATCH because I can delete entire colony of clone if I use delete? Even you see all the help didn't seems know the answers... why?

  • @Piokoxer
    @Piokoxer Год назад

    a little question: let's say i detect a collision with a clone, how do i get its ID?
    it's the last thing i need to finish up my ball physics engine (and just now i realised Griffpathc made a vid on it... whatever, doing it myself is more fun)

    • @SurfingScratcher
      @SurfingScratcher  Год назад

      It's been a while since I made this. I'm guessing that I would try and read the local variable's value in the place where I'm detecting the collision.
      When you start as a clone, you're probably detecting some collisions there. You could 'wait until you collide with object and read its value then. Just some ideas.

    • @Piokoxer
      @Piokoxer Год назад

      @@SurfingScratcher i ended up writing my own collision system with lists of every clone's x pos, y pos, x vel, y vel, and radius. It works!
      God is vector math a pain in the ass when you only have the components
      And you're a 13 year old working with vectors for the first time

    • @SurfingScratcher
      @SurfingScratcher  Год назад +1

      @@Piokoxer I think you're epic! Great work on solving your own problem :)

  • @bananaman5238
    @bananaman5238 3 года назад

    Is it possible to find the x,y position of a clone with another sprites clone and have the other sprites clone go to the clone

    • @SurfingScratcher
      @SurfingScratcher  3 года назад +1

      Hi skruffles, my head's in a bit of a twist reading that. I'm going to rephrase to see if I'm understanding you.
      Sprite A (clone) wants to read the x,y position of Sprite B's (clone). You want Sprite A's (clone) to go to Sprite B's (clone)?
      You can store the x and y positions of clones in a list. If you use the 'id' approach that's in the video, then the item number of the list can refer to the 'id'.
      So if you have a list called xPositions, then item 1 would be the x position of the clone with id = 1.
      I'm curious to know what trigger (event/user interaction) prompts the Sprite A's (clone) to go to the xy of the Sprite B's (clone).
      Because if you know the target position based on a user event, you can capture those in variables. This approach acts like a bridge between the two.
      Good luck!

    • @bananaman5238
      @bananaman5238 3 года назад

      @@SurfingScratcher yup you got it and this helps me alot, thanks!

  • @pancakepete7809
    @pancakepete7809 2 года назад

    omg thankyou, my shooter is playable

  • @arctico3o891
    @arctico3o891 3 года назад

    I have a question for you because you seem like you know a lot about scratch. How could I make it so that my clone goes to a randomized piece of a(for example) 12 by 12 grid? I will send a link to the game in the reply section of this comment. Please respond in the comments of the game.

    • @SurfingScratcher
      @SurfingScratcher  3 года назад

      HI arcticwolf, you could probably just use some maths to help you out with this one. You'll have 12 x positions for each row. You'll have 12 y positions as well. The coordinates are just combinations of these.
      If each piece has an id, then you can locate its x and y position. The first 12 pieces will have id's from 1-12.
      Say you want id = 6. Well that's just going to be 6 x width of piece. All the y positions in the row will be different. You can also use the mod operator to figure this out. 6 mod 12 = 6, for the next row, 18 mod 12 = 6. Check out my video on Scratch operators including mod if that's confusing.
      For the y positions, you can just divide the id by 12 and round it to the floor or ceiling depending on how you like to do it. For example, 13/12 = 1.08. If you ceil that, it rounds it up to 2. Then you can just multiply the height of the piece by the result of the division. It will work for each row of you grid.
      Here's a project that creates a grid based on mods: scratch.mit.edu/projects/332495324
      Okay, so now that you can calculate x,y coords based on an id, you should be able to send the clone of another sprite to that location.

  • @notrhythm
    @notrhythm 8 месяцев назад

    6:35 im late to the party, but when you fire a bullet, the other existing bullets also create a clone of their own as you have the event to create a clone on the sprite itself.

  • @dashady1367
    @dashady1367 2 года назад

    Do you know how to hide clones on a certain backdrop? Then show them on another

    • @SurfingScratcher
      @SurfingScratcher  2 года назад

      Should be doable. You'll just need to create a local variable for the clone that tells it which backdrop to follow or not to follow.
      Then when you switch backdrops, broadcast an event and get the sprite of the clone to check if its local variable is equal to that of the current backdrop.

  • @tjwthedj1355
    @tjwthedj1355 2 года назад

    How do I make the turret to do that

  • @kenadelglass7933
    @kenadelglass7933 4 года назад

    Great videos. Been teaching Scratch since 2015 and learned a thing or two from you. Thank you for sharing. Can you make two or more cloned ball sprites that are moving and bouncing bounce off each other? I can do this when they are the same color using touching color but what if they are different colors?

    • @SurfingScratcher
      @SurfingScratcher  4 года назад

      Hi Ken, thanks for dropping by with your comment. Pumped that you've found some value in the video!
      Here are two ideas that come to mind for me:
      You could probably wrap the color sensing blocks in the "OR" boolean blocks as a starting point. Though, that wouldn't account for a random color.
      A more advanced solution would be to track the x,y positions of the clones using a list. Then you would calculate the distance between the center's of each ball. If the distance is less than the radius of the ball, then you would have a collision. This solution would have some performance issues if you had lots of balls.

  • @justnick7779
    @justnick7779 3 года назад

    Why when I am making a clone, his script isn't working only if I click on it

  • @OhioStudiosOG
    @OhioStudiosOG 2 года назад

    Nice, but the script broke after a while and the bullets wouldnt stop existing after hitting the wall, but only a enemy i made it hit. What should i do?

    • @SurfingScratcher
      @SurfingScratcher  2 года назад

      You'll want to sense if touching the wall and then delete the clone once it's true.

    • @OhioStudiosOG
      @OhioStudiosOG 2 года назад

      @@SurfingScratcher Thanks

  • @aguy1844
    @aguy1844 2 месяца назад

    I didn't realize local variables are also local to clones. I've been encoding information in costume number and direction😢.

  • @batuhankoyuncuoglu2311
    @batuhankoyuncuoglu2311 4 года назад

    Thank you very much :)

  • @subzero.cuber47
    @subzero.cuber47 3 года назад

    7:00 you can also do
    When green flag clicked
    {; forever
    If
    Create clone of (myself)
    ;}

    • @subzero.cuber47
      @subzero.cuber47 3 года назад

      The issue is you can trigger it without the green flag

    • @subzero.cuber47
      @subzero.cuber47 3 года назад

      It also makes the isClone variable obsolete, because green flag is for original sprite but space key applied to both original and clones

    • @subzero.cuber47
      @subzero.cuber47 3 года назад

      Also I subbed

  • @shashibhushan4445
    @shashibhushan4445 4 года назад +2

    Is there a way I can make clones act like sprites?
    Also, you make awesome informative videos.

    • @SurfingScratcher
      @SurfingScratcher  4 года назад +1

      Hi Shashi, thanks for your comment and question :) A clone is a sprite - it's a clone of a sprite. It 'inherits' all the behaviour that you've coded for the sprite you've cloned. The way to control it (like a sprite) is to use a 'When I start as a clone' hat block. That's the sprite way of saying (hey the green flag has been clicked, come into existence and do your thing).

  • @neitine8255
    @neitine8255 2 года назад

    It was that easy and i just tried to make something with lists

  • @FlameAndSlime
    @FlameAndSlime 4 года назад +1

    What are the differences between global and local variables? How do they work together? And what would happen if 'bulletID' was set to 'For all sprites'? Would it make any difference?

    • @SurfingScratcher
      @SurfingScratcher  4 года назад +1

      Yep, it would make a difference. That exact situation is explained in the video. 'globalID' is essentially the 'bulletID' that has been set to 'For all sprites'. It means that all clones will share this one value. No clone will have its own copy of it.
      When set to 'this sprite only' a clone will get its own copy of the variable. If the clone changes the value of the variable it only changes for that clone's copy, not any of the other clones.
      For all sprites = same value for every clone
      This sprite only = each clone has its own copy

  • @ppcat8630
    @ppcat8630 3 года назад

    how 2 create a specific amount of clones?

    • @ppcat8630
      @ppcat8630 3 года назад

      like if i wanna create 3 clones, i just wanna create 3 clones

    • @SurfingScratcher
      @SurfingScratcher  3 года назад

      @@ppcat8630 put ' create a clone' in a repeat 3 times block. Do it on a green flag press.

  • @JoshCartman
    @JoshCartman 4 года назад

    Hey I'm trying to use Scratch clones for a Lives indicator. I read something about Clone IDs but I'm not getting it. Can you help me? I got as far as generating the Clones on the screen but I don't know what to do next.

    • @SurfingScratcher
      @SurfingScratcher  4 года назад

      If you wanted to create lives for each clone, then you would have a variable FOR THIS SPRITE ONLY called something like lives. Then, use a 'When I start as a clone' hat block to continually check if the clone should lose a life.
      Something like, if bullet touches clone then change lives by -1

  • @leopaveley
    @leopaveley 4 года назад

    Hey! I've been working in Scratch and come across a really nasty problem. So basically, is there any way I can read a specific clone's coordinates/direction. Say, one that touches the player. This would truly help me a lot and you seem experienced. :)

    • @SurfingScratcher
      @SurfingScratcher  4 года назад

      Hi T and S Productions, thanks for your question. The 'id' system that's covered in the video can solve this issue. In fact, if you put your code inside the 'when I start as a clone' block and read the x and y reporter blocks it will report. You could use lists to make them global. Something like this:
      .
      .
      You'll need to assign a local variable called 'id'
      You'll need to create a list called x-coords
      You'll need to create a list called y-coords
      .
      .
      In the 'when I start as a clone' hat block, put a 'repeat until' block. Repeat until touching the player. Inside the repeat until, you could set the x-coords at the item location of the id and set its current x value. Do the same for y. Remember, this is only if you want them globally. I might make a video on this if it's confusing as I think it will help a number of people. But see how you go :) Good luck!

    • @leopaveley
      @leopaveley 4 года назад

      @@SurfingScratcher With your advice, I managed to make it work! Thank you so much :)

    • @SurfingScratcher
      @SurfingScratcher  4 года назад

      @@leopaveley Unreal banana peel!

  • @geogames8206
    @geogames8206 2 года назад

    Mine makes more than 1 clone for some reason

  • @VillagerJack
    @VillagerJack 3 года назад

    my clones all teleport to the gun when i press space

    • @SurfingScratcher
      @SurfingScratcher  3 года назад

      Hi Jack, thanks for sharing. I suspect that you may have a go to position of gun in the space key press hat block. You will want to position the clone in the 'when I start as a clone' hat block.If you do it in the space key press, then it will apply to every clone and not the one that is created.

    • @VillagerJack
      @VillagerJack 3 года назад

      @@SurfingScratcher thank you

  • @Pepsi_inc
    @Pepsi_inc 2 года назад

    eu entendi 85% vou ver de novo pra entender 100%😅😅😅😅

  • @user-bd6mk6cg5w
    @user-bd6mk6cg5w 3 года назад

    Um first sorry for bad English
    -Im using duplicate block to make bullets but if i shoot many bullets(duplicate many times), bullets stop duplicating.
    Im using scratch2 and am i have to use 3?-
    Sorry! Never mind me! I found that i didint put delete duplicate box lol thx!

    • @ShineOrSomething
      @ShineOrSomething 3 года назад +1

      i have the same problem but i don't know what a delete duplicate box is, can you pls tell me? :)

  • @zgreatest69
    @zgreatest69 4 года назад

    WOW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @austino7770
    @austino7770 3 года назад

    I'm gonna make a game out of this. Also, this comment is the 100th comment!

  • @ultimate3000
    @ultimate3000 Год назад

    didn't work, now i cant even fire once.

  • @-absoulute_machine-
    @-absoulute_machine- Год назад

    i understood none of that

    • @SurfingScratcher
      @SurfingScratcher  Год назад

      Watch it again!

    • @SurfingScratcher
      @SurfingScratcher  Год назад

      I'm learning Combine from Apple at the moment and I need to rewatch content sometimes to help build my understanding.

  • @jbarrettSRQ
    @jbarrettSRQ Год назад

    great to have a clone tutorial. But please don't make them of weapons. Please make it gender neutral and peaceful. thank you

    • @SurfingScratcher
      @SurfingScratcher  Год назад

      Thanks for the feedback and it's useful to consider going forward. If you were to remake this clones tutorial, what themes/props would you use in its place?

  • @Legac706
    @Legac706 Год назад

    dude just put when space clicked create clone of myself wait until not key space pressed