Scratch ENEMY AI | Top Down Shooter (Ep. 2/2)

In this Scratch tutorial, I show how to finish the top-down shooter by adding enemy AI that chases the player!
📺 First Top-Down Shooter Video: • Scratch Top Down Shoot...
🎮 Get The Game's Assets: scratch.mit.edu/projects/6788...
Thanks for watching! Please hit the like button and subscribe for future Scratch tutorials!
🔗 LINKS:
Scratch Profile Page: scratch.mit.edu/users/ShiftCl...
Night Ninja Scrolling Platformer: • Scratch | Scrolling Pl...
Cat Clicker tutorial: • Scratch | Cat Clicker ...
Tower Defense tutorial: • Scratch | Making a Tow...
How-to tutorials: • Scratch | How-To Tutor...
Get Scratch Addons: scratchaddons.com/
🧾CHAPTERS:
00:00 - Intro
00:24 - Enemy Spawning
01:46 - Camera Movement
02:31 - Repositioning Enemies
03:06 - Enemy Movement
05:33 - Enemy Collision
07:16 - Enemy Health
10:30 - Score Stuff
11:58 - Particles
14:37 - Outro
❗ DISCLAIMER:
This video is family-friendly! Hostile and/or rude comments will not be tolerated!

Пікірлер: 168

  • @ShiftClickLearn
    @ShiftClickLearn2 жыл бұрын

    Thanks for watching! Make sure you watch the first top-down shooter game episode! Here's the link: kzread.info/dash/bejne/o3ds0cZtptO0ZJc.html

  • @Goin_VR

    @Goin_VR

    6 ай бұрын

    can i play the final results???????

  • @Fudgecrumb
    @Fudgecrumb2 жыл бұрын

    Keep up the tutorials! Your content is amazing and well edited :)

  • @gummybear4927
    @gummybear49272 жыл бұрын

    Thanks for the tutorials! Didn't come here to code this game but helped me know more so I can implement these features into my projects. Keep up the good work!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Glad I could help! Thanks! :D

  • @gummybear4927

    @gummybear4927

    2 жыл бұрын

    @@ShiftClickLearn :D

  • @azmaintheproplayer2847
    @azmaintheproplayer28472 жыл бұрын

    Me : *not motivited in Scratch* Shift Click Learn : *Posted a new video* Me : BACK TO SCRATCH!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    XD Thanks!

  • @AirLiftingMonkeys
    @AirLiftingMonkeys2 жыл бұрын

    I've been waiting along time for this video😍

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Awesome!

  • @sakkamsamerkhan8102
    @sakkamsamerkhan8102 Жыл бұрын

    I have been looking for a video like this thanks now I can continue making a top down game ❤

  • @ChesterCpt
    @ChesterCpt2 жыл бұрын

    Keep making tutorials! You're the best!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thanks, will do!

  • @blup9997
    @blup999717 күн бұрын

    I have bug i encountered that the enemy hitbox doesnt work they still merge into eachother and stops moving,its not noticable in your game becuase the enemies are just squares with the same color but in my game they have actual costumes so its very noticable

  • @katiefrye7489
    @katiefrye7489 Жыл бұрын

    I loved this episode its so cool and easy I always watch you.

  • @ShiftClickLearn

    @ShiftClickLearn

    Жыл бұрын

    Thank you! :D

  • @YouthExploreStudy
    @YouthExploreStudy Жыл бұрын

    Your tutorial was awesome, but I have a question is the Movecamera custom block run without screen refresh or not?

  • @imperialwaffle
    @imperialwaffle Жыл бұрын

    Keep up the good work!

  • @ShiftClickLearn

    @ShiftClickLearn

    Жыл бұрын

    Thanks, will do!

  • @kayrayaynda9144
    @kayrayaynda91442 жыл бұрын

    That's awesome!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thank you!

  • @sweazerelli4311
    @sweazerelli43115 ай бұрын

    My bad but I went back to try and your this tutorial because it was like the first thing I tried just to get the hang of it that I saw to mess up scratching it was a bad.. but now I've actually made it work cuz I got a little bit more knowledge but I am having a problem still with the switch of the icon but big thank you big big help your back you're the best

  • @manreen_harjas3945
    @manreen_harjas3945 Жыл бұрын

    LEZ GGOOOOOOO NEW VID

  • @elFranCiscoJelCR4CK2000
    @elFranCiscoJelCR4CK200010 ай бұрын

    is possible to do that the bullet goes offscreen and damage the offscreen enemies?

  • @NoobGuy621
    @NoobGuy621 Жыл бұрын

    quick question - Like you made a move block that works with scrolling can you give me code for gliding block that works with scrolling?

  • @isuckatvideos3089
    @isuckatvideos30893 ай бұрын

    Hey, idk if the enemies are supposed to be stuck together or not for collision, when i made collision they are just stuck together or not. Very good tutorial. It helped me learn new movement and all

  • @Kilvu
    @Kilvu2 жыл бұрын

    Amazing :D

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thanks! 😄

  • @norainirapee832
    @norainirapee8322 жыл бұрын

    Just a little curiosity, how do u make the enemies shoot bullets and stuff. I kinda need tht tutorial honestly

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Ooh, that would take some math for sure, similar to the move steps custom block... That's a good tutorial idea! Thanks! :D

  • @savagecatdev
    @savagecatdev2 жыл бұрын

    Scratch Speedrun lol i like that you code fast though other youtubers are so slow i have to skip some of the video to actually start coding

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    LOL, awesome! It can be hard to find a good pace to record- on one hand I don't want to go really fast because people wouldn't be able to follow, but if I go really slow, the video will be 1000 hours long xD. Thanks for the comment! :D

  • @williambaldwin8763
    @williambaldwin8763Ай бұрын

    Very helpful! But, what if I have different enemy types? How would the collisons work for the different sizes and shapes?

  • @chonker5070
    @chonker5070 Жыл бұрын

    Whenever I get close to an enemy, to enemy it glitches side to side. Is there any way to fix it?

  • @AestheticGamerJourney
    @AestheticGamerJourney2 жыл бұрын

    awesome thx!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    You're welcome!

  • @Therealbluu
    @Therealbluu2 жыл бұрын

    awesome tutorial

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Glad you liked it! :D

  • @Toptizz
    @Toptizz2 жыл бұрын

    AWSOME

  • @PhatBastard-oi9pm
    @PhatBastard-oi9pm Жыл бұрын

    question: if i were to make a wave based shooter using the same scripts, would it function the same?

  • @ollib9837

    @ollib9837

    Жыл бұрын

    Yes, I just did that

  • @scnhappytunes1800
    @scnhappytunes18002 жыл бұрын

    I love you videos!!!!!!!!!!!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thanks!!! :D

  • @DamageTick
    @DamageTick2 жыл бұрын

    can you make a tutorial on particles coming from dead clones. i am trying to make a zombie shooter game and i want to add some polish, but these particles don't work for me as i have a fixed camera and not a moving one like you.

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Did you try hiding the clone then creating the particles?

  • @DamageTick

    @DamageTick

    2 жыл бұрын

    @@ShiftClickLearn my particles are working just fine now. i had to teach myself how to use lists, but now they seem to work. if you could make a tutorial on particles without a scrolling background that would be amazing.

  • @pboltz2706
    @pboltz2706 Жыл бұрын

    I found a problem in the collisions, if the sprite was a circle the collision code gets buggy like i saw some enemies overlapping each other, is there any way of fixing this?

  • @ShiftClickLearn

    @ShiftClickLearn

    Жыл бұрын

    Hmm, maybe try making the collision detection costumes curved as well? I'm not sure if that will work tho...

  • @pboltz2706

    @pboltz2706

    Жыл бұрын

    It kinda work I just need to update the collision code I guess thanks!

  • @__tinhvuvuong
    @__tinhvuvuong8 ай бұрын

    100/10 good video:)

  • @muhammadfazil5179
    @muhammadfazil51792 жыл бұрын

    Late night right now. Seeing this vedio 2 hrs after upload

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Awesome!

  • @sannillangamagerishongebri2820
    @sannillangamagerishongebri28202 ай бұрын

    the particle script doesn't work when I kill a monster in my game the particle spawn somewhere else and does not do that cool explosion effect

  • @dunnomynameso746
    @dunnomynameso7462 жыл бұрын

    Just finished watching part 1 and realized this was uploaded a few hours ago lol

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Lol awesome!

  • @nuratlamos8541
    @nuratlamos85412 ай бұрын

    When I make the minimum size the enemys become big how do I fix that?

  • @Forest_turkey
    @Forest_turkey4 ай бұрын

    yoo bro whenever i move the the enmy changes back to false why does that happen

  • @AVeryRandomDude
    @AVeryRandomDude2 жыл бұрын

    Hi, I watched but I forgot to comment!!!

  • @DuySHOA
    @DuySHOA2 жыл бұрын

    Hello my friend. Video hay quá.

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Hiii1

  • @ItsJustTim
    @ItsJustTim2 жыл бұрын

    @ShiftClickLearn Whenever I Shoot A Enemy All Of The Other Enemies All Get To The Same Size As The Enemy I Shot, Is There Any Way To Fix This?

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Ooh, did you make the health variable for this sprite only? Otherwise, ALL of the enemies will share the same health variable.

  • @ItsJustTim

    @ItsJustTim

    2 жыл бұрын

    Yes Got It Working Thanks For The Advice (I Love Your Vids Btw My Favs Are The 1 Episode Game Ones!)

  • @dudechase5661
    @dudechase56612 жыл бұрын

    thank you

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    You're welcome!

  • @scnhappytunes1800
    @scnhappytunes18002 жыл бұрын

    you got it! :D

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Got what?

  • @scnhappytunes1800

    @scnhappytunes1800

    2 жыл бұрын

    @@ShiftClickLearn watching the first video.

  • @zancrniveckalar2593
    @zancrniveckalar25932 жыл бұрын

    super helpful, but I still can't manage to add wall collision. Any tips?

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    I would first remove the movement from this game and replace it with the movement from the wall collision tutorial! :D

  • @zancrniveckalar2593

    @zancrniveckalar2593

    2 жыл бұрын

    @@ShiftClickLearn yeah, the movement in this tutorial is made to be a bit more smooth, would the movement from the collision tutorial still work with everything else (enemies, bullets...)

  • @TherealSTAR_BOUND
    @TherealSTAR_BOUND8 ай бұрын

    Can you make one for something similar to 20 minutes till dawn

  • @enzo_6416
    @enzo_64162 жыл бұрын

    coolio

  • @shahinma221
    @shahinma2212 жыл бұрын

    imma shot the like button

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    lol

  • @shahinma221

    @shahinma221

    2 жыл бұрын

    @@ShiftClickLearn xd

  • @anasoares9366
    @anasoares93662 жыл бұрын

    I have a solution for Enemy Collisions, make a variable, name it MYSELF with the name of the sprite, and inside the touching (…)? Block, put the variable in the string input.

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Woah, will that work? I'll look into that! Thanks for the tip! :D

  • @smg400v5

    @smg400v5

    Жыл бұрын

    I tried it and the enemies were still colliding but they were also still chasing me.

  • @NRGWILL44
    @NRGWILL44 Жыл бұрын

    I copied the code for camera movement but it doesn't seem to be working. anyone got any tips?

  • @leviwastooshort478

    @leviwastooshort478

    Жыл бұрын

    IDK its the same 4 me

  • @penguinpenguin3156
    @penguinpenguin31562 жыл бұрын

    I hope you add multiplayer it would be fun!Or you can do a other tutorial

  • @azmaintheproplayer2847

    @azmaintheproplayer2847

    2 жыл бұрын

    agree

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    That would be really cool and also very complex!

  • @penguinpenguin3156

    @penguinpenguin3156

    2 жыл бұрын

    @@ShiftClickLearn yeah a couple of tutorials but you dont have to I hope you do great vids :D

  • @qwertyuiopasdf160

    @qwertyuiopasdf160

    2 жыл бұрын

    Or maybe a co-op

  • @penguinpenguin3156

    @penguinpenguin3156

    2 жыл бұрын

    @@qwertyuiopasdf160 i mostly want more than two people though

  • @ytgaming-gd6gq
    @ytgaming-gd6gq3 ай бұрын

    The bullets when i shot it kept going up so I made the speed different and steps but thanks for this i keep wanting to learn

  • @AVeryRandomDude
    @AVeryRandomDude2 жыл бұрын

    Little bug: If you go all the way to the left or right or any direction that are far away from spawn, enemies will spawn really far to you I think to fix this, you need to set the x and y spawn that pick random from the player current x and y

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Oh, that's a good tip!

  • @AVeryRandomDude

    @AVeryRandomDude

    2 жыл бұрын

    @@ShiftClickLearn thanks :D

  • @Whateverwhatever648
    @Whateverwhatever648 Жыл бұрын

    Hey you don;t have to do this but I would like it if you made a video where if there is a object in the enemy ai view then they won’t follow you

  • @Lakon_Two
    @Lakon_Two10 ай бұрын

    Can someone tell me how to make the enemies smaller?

  • @ytgaming-gd6gq
    @ytgaming-gd6gq3 ай бұрын

    When i tried to make enimes move they stay still please help

  • @JackNoEyes
    @JackNoEyes8 ай бұрын

    Would it be possible to make a scratch shooter game where the enemies shoot at you without needing a ton of sprites?

  • @parkerdedrick8967

    @parkerdedrick8967

    8 ай бұрын

    There aren’t many sprites 💀

  • @parkerdedrick8967

    @parkerdedrick8967

    8 ай бұрын

    But yes. It would be possible.

  • @JackNoEyes

    @JackNoEyes

    8 ай бұрын

    I mean like making the enemies bullets all clones that come from cloned enemies, sorry for the confusion and thanks for replying @@parkerdedrick8967

  • @harishankar-fh4wv
    @harishankar-fh4wv2 жыл бұрын

    Hey can you make an RPG series tutorials

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    That would be really cool! I have something else planned tho... ;D

  • @yehtetthar9949
    @yehtetthar9949 Жыл бұрын

    indeed very nice i thought im not gonna make it because the bullet didn't come out of the gun it just gone over it but i just realized i have to change the direction of the bullet to 0 the it come out of the gun

  • @yehtetthar9949

    @yehtetthar9949

    Жыл бұрын

    HEREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE GOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!

  • @ShiftClickLearn

    @ShiftClickLearn

    Жыл бұрын

    nice....

  • @misterdot6923
    @misterdot69232 жыл бұрын

    YES

  • @misterdot6923

    @misterdot6923

    2 жыл бұрын

    awesome content! keep it up.

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thank you, will do! :]

  • @kathleenwyner
    @kathleenwynerАй бұрын

    can anyone help?? the icon stuff for the enemies isn't working

  • @kathleenwyner

    @kathleenwyner

    Ай бұрын

    please i have to submit this tomorrow for my final

  • @kaustubhshrestha1265
    @kaustubhshrestha12652 жыл бұрын

    you should make a studio like griffpatch for the project

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    That would be cool...

  • @thederbly6009
    @thederbly6009 Жыл бұрын

    How can you add wall collision in this?

  • @ShiftClickLearn

    @ShiftClickLearn

    Жыл бұрын

    I have a tutorial on wall Collison! You'd basically replace the movement shown in this video with my other tutorial. Here: kzread.info/dash/bejne/gaGGypiMiNKvYLw.html

  • @thederbly6009

    @thederbly6009

    Жыл бұрын

    Thanks

  • @doomdead165
    @doomdead165 Жыл бұрын

    this was really good but only 1 enemy was moving with the camera

  • @ThatHPfan
    @ThatHPfan4 ай бұрын

    Does not work my enemies keep spawning on my player 4:48

  • @qwertyuiopasdf160
    @qwertyuiopasdf1602 жыл бұрын

    Time to copy-paste and change the texture and call it my game

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    lol... please give credit tho xD

  • @qwertyuiopasdf160

    @qwertyuiopasdf160

    2 жыл бұрын

    @@ShiftClickLearn sure lol

  • @soap_.47
    @soap_.47 Жыл бұрын

    the "costume" code wont work correctly

  • @m7f2t9
    @m7f2t911 ай бұрын

    my scrolling is not working Please help me

  • @TERRABLADE-uy7bh
    @TERRABLADE-uy7bh10 ай бұрын

    a small bug: the enemies still collide with the offscreen enemies

  • @gluciorek1491
    @gluciorek14912 ай бұрын

    THE GUN IS STUCK WHEN I GO TO LEFT OR RIGHT

  • @nikshitsharma9671
    @nikshitsharma96712 жыл бұрын

    The enemies aren't following me, explain please...

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Did you copy the Move "steps" steps block correctly? (This one: kzread.info/dash/bejne/X4ybqtuQfsTepM4.html )

  • @nikshitsharma9671

    @nikshitsharma9671

    2 жыл бұрын

    @@ShiftClickLearn, Yes. I did...

  • @yosephdawson7045
    @yosephdawson70452 жыл бұрын

    430 viewvs 7 hrs ago Ayo 😳

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    😳😳😳

  • @YouthExploreStudy
    @YouthExploreStudy Жыл бұрын

    I found I little bug, that is enemies can get stuck from icons, I think because they are in the same sprite.

  • @scary_daddy

    @scary_daddy

    Жыл бұрын

    Yeah, at the moment my enemies are also stuck as icons, Scratch must've had an update that changed something

  • @Frogster08
    @Frogster084 ай бұрын

    5:45

  • @notsamm43
    @notsamm432 жыл бұрын

    HOLA!!!!!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    HELLO!!!!! :D

  • @irfansyahmin697
    @irfansyahmin697 Жыл бұрын

    This video cuts a lot, I couldn't catch up most of it.. Hopefully, you fix this..

  • @SUPY_
    @SUPY_2 жыл бұрын

    Add recording system or bad

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    0-0 lol

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    good idea

  • @SUPY_

    @SUPY_

    2 жыл бұрын

    @@ShiftClickLearn It is actually easy, for player just store every single move and shoot for enemy store enemy type and time when enemy spawned. And for playing recording just disable moving skript and enemy spawn loop, moove player according to list and spawn enemy according to its list. Enable other game loop skripts

  • @deansomes6254
    @deansomes6254 Жыл бұрын

    Good tutorial but if you could do it a little slower that would be much apprisheated

  • @Rthbtynyjmmbfgrvtrg
    @Rthbtynyjmmbfgrvtrg4 ай бұрын

    Bruh, there is one more like until it is 666😂😂😂

  • @muhammadfazil5179
    @muhammadfazil51792 жыл бұрын

    29th like

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    thanksssss

  • @ITZME10101
    @ITZME101012 жыл бұрын

    61th veiw and 13th like

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thank you! :D

  • @Marco-kl7ds
    @Marco-kl7ds Жыл бұрын

    hi

  • @ShiftClickLearn

    @ShiftClickLearn

    Жыл бұрын

    helloo

  • @Forest_turkey
    @Forest_turkey4 ай бұрын

    wwooooowww i'm commenting on my own videooooo

  • @marcusfelberbaum3629
    @marcusfelberbaum36292 жыл бұрын

    Your Tutorials Are Really Good But Can You Speak Slowly.

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Thanks! Sorry about that- if you need, you can slow the video down. (Settings > Playback speed > 0.75 or 0.5)

  • @marcusfelberbaum3629

    @marcusfelberbaum3629

    2 жыл бұрын

    @@ShiftClickLearn Thankyou

  • @lifelonglist2136
    @lifelonglist2136 Жыл бұрын

    bro went to fast i messed up my whole project and cant fix it

  • @TheRealKensterBoosteryt

    @TheRealKensterBoosteryt

    2 ай бұрын

    Same.

  • @Achrylis
    @Achrylis11 ай бұрын

    The enemy's still stupid tho

  • @Heillygamings
    @Heillygamings18 күн бұрын

    hard please easier

  • @riddleworld1618
    @riddleworld16182 жыл бұрын

    69 not op

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    aHHhh

  • @moumitasil6757
    @moumitasil67577 ай бұрын

    😠

  • @BiscutGameplay
    @BiscutGameplay3 ай бұрын

    This is very laggy

  • @ananemy7517
    @ananemy75172 жыл бұрын

    I always click on dislike even tho i love it :/

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    wHY 😭 XD

  • @TheRealKensterBoosteryt
    @TheRealKensterBoosteryt2 ай бұрын

    Bad tutorial. Went too fast. All the enemies spawn in a line and won’t move when I move. All bc you rushed.

  • @NinjaCoconutoffical
    @NinjaCoconutoffical Жыл бұрын

    I am dissapointed. You are lying. Is not working and link for game is not real.

  • @AVeryRandomDude
    @AVeryRandomDude2 жыл бұрын

    Me seeing 10:44 Take the number counter from the backpack (made by griffpatch, go check him out) and got the job done, 100% center!

  • @ShiftClickLearn

    @ShiftClickLearn

    2 жыл бұрын

    Griffpatch's number counter is good! (You could also use mine hehe.) :D

  • @AVeryRandomDude

    @AVeryRandomDude

    2 жыл бұрын

    @@ShiftClickLearn I will use yours cuz this is your game :D