Goodbye Sweet Enemy - BONUS EPISODE | Scratch Platformer Tutorial e14

griffpatch · Beginner ·💻 AI-Assisted Coding ·2y ago

Key Takeaways

This video teaches how to code enemy defeat mechanics in a Scratch platformer game

Full Transcript

hello fellow scratchers I'm Griff patch you remember me yeah it's been too long but over the next few weeks I'll be releasing a number of videos continuing my very popular classic platformer series do you still have that project kicking around I hope so because we have some great updates to add so many scratchers put in their requests and top of the list was that you wished that once an enemy Was Defeated that they stayed defeated but the rest of the level well no problem this shouldn't be too complex load up your platformer projects and blow off the dust guys let's get scratching now you may wonder why it is that when we dispatch an enemy they just keep coming back whereas if we collect an apple or a key the Collectibles are able to stay gone and do not return well that's because our Collectibles are created as clones that exist throughout the game only being hidden when we change scene whereas our enemies are deleted between scenes and get recreated on entering a new scene for this reason we are going to need another means of keeping track of when a given enemy has been squished the best way would be using a scratch list make a new one now naming it squished and ensure it's created for all Sprites that's very important so that it works across clones now we need to ensure we reset this list when the gate Begins the best event to hook this off is the setup event so in the enemy Sprite when I receive setup delete all the squished list but now we need a way to identify each enemy clone from one another looking under the when I receive change scene in the enemy Sprite we do specify the type of enemy but we don't give each one a unique ID a name that will identify them from one another so right click and edit the spawn custom block we'll add in a new label ID with a new input also named ID that means we can now assign each enemy a unique ID to identify it but we do have to be careful because if you remember these top two enemies are actually the same enemy we just pick one depending on which direction we need to spawn it in from so we're going to name them both I don't know R1 or red one or Bob it doesn't really matter as long as it's their name and no others then just give each other one a completely unique name okay scroll down to the Define spawn script we need to make a record of the past in ID make a new variable named yeah ID yet again this time making it for this Sprite only it's their ID and no one else's and we set ID to the input variable ID cool so that should now mean each enemy knows who they are and that's great because if this squished list contains our ID well then we don't want them coming back to life anymore do we stop this script and drop it in before we have chance to create any new enemy clone awesome the only thing missing is actually recording which enemies have been squished well this shouldn't be hard I wonder if you already know how you might do this we find the Define touching player script these top scripts trigger when the player squishes this enemy so we simply need to add an item to the squished list and that item is this enemy's unique ID variable and it can go somewhere near the top like when we are playing the squish sound guys smash that green flag and let's see if this does the job jumping on my first enemy and you'll see that their unique ID R2 has been added to our list perfect I'll avoid the second one for now and then return to see if R2 has respawned and they haven't excellent news so let's squish R2 as well great and wow suddenly our world feels so much more empty than before ha well it's the price you pay if you want to have despawning enemies it's your call some games do and some don't anyhow we will be able to balance this out by adding other types of undefeatable enemies and perhaps enemy generators later on in a further bonus episode well surprisingly this is the end of this short episode I told you this wasn't going to be too complex you I just want to double confirm that when we lose all our lives and then restart the game that all the enemies do in fact return as planned but apart from that yeah well done this is looking epic but I think you're going to love the next episode even more it's super exciting because guys we'll be adding lying enemies how cool is that so that is it for today I hope you enjoyed this little bit of fun have a great week ahead and scratch on guys [Music]

Original Description

Find out how to finally say goodbye to our enemies for good in this bonus episode of our Classic Platformer Series, episode 14 - Amazing! So, many Scratcher’s put in their requests, and top of the list was that you wished that once an Enemy was defeated, that they “stayed” defeated for the rest of the level. Well! no problem, this shouldn’t be too complex! Guys let’s get Scratching! My tutorials are for all budding game & software developers using Code Blocks. Scratch On guys! 👀 Next Episode #15 - https://youtu.be/P3u96dbBiZ0 👀 First Episode - https://youtu.be/D16hTnDGweo 👀 Playlist - https://www.youtube.com/playlist?list=PLy4zsTUHwGJIATydhFeZa5pspLZR7yE__ 🚀 *Boost Your Creativity with Griffpatch* The Griffpatch Academy will take you from "Gamer to Game Creator" Learn more at 👉 https://griffpatch.academy 👈 😺 Scratch was developed by the Lifelong Kindergarten Group at the MIT Media Lab. See http://scratch.mit.edu ❤️ Scratch Addons - https://scratchaddons.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from griffpatch · griffpatch · 0 of 60

← Previous Next →
1 Burrow Blitz - A game by Griffpatch
Burrow Blitz - A game by Griffpatch
griffpatch
2 Burrow Blitz Level 1 Speed Run!
Burrow Blitz Level 1 Speed Run!
griffpatch
3 Scratch Messaging Extension (for chrome & firefox)
Scratch Messaging Extension (for chrome & firefox)
griffpatch
4 Scrolling Platformer Tutorial | Part 1 | Get Scrolling
Scrolling Platformer Tutorial | Part 1 | Get Scrolling
griffpatch
5 Scrolling Platformer Tutorial | Part 2 | Gravity
Scrolling Platformer Tutorial | Part 2 | Gravity
griffpatch
6 Scrolling Platformer Tutorial | Part 3 | Platform Detection
Scrolling Platformer Tutorial | Part 3 | Platform Detection
griffpatch
7 Scrolling Platformer Tutorial | Part 4 | Off Screen Sprites and Player Death
Scrolling Platformer Tutorial | Part 4 | Off Screen Sprites and Player Death
griffpatch
8 Scrolling Platformer Tutorial | Part 5 | Collectables
Scrolling Platformer Tutorial | Part 5 | Collectables
griffpatch
9 Scrolling Platformer Tutorial | Part 6 | Danger Sprites (Bug fix)
Scrolling Platformer Tutorial | Part 6 | Danger Sprites (Bug fix)
griffpatch
10 Scrolling Platformer Tutorial | Part 7 | Exit Portal
Scrolling Platformer Tutorial | Part 7 | Exit Portal
griffpatch
11 Scratch 3 | Box2d |  Physics Extension
Scratch 3 | Box2d | Physics Extension
griffpatch
12 Scrolling Platformer Tutorial | Part 8 | Vertical Scrolling
Scrolling Platformer Tutorial | Part 8 | Vertical Scrolling
griffpatch
13 Zombie Cube | Speedrun challenge
Zombie Cube | Speedrun challenge
griffpatch
14 Scratch 3 | Physics Extension | Version 2
Scratch 3 | Physics Extension | Version 2
griffpatch
15 Top Down Scroller | E1 - Scrolling | Scratch Tutorial
Top Down Scroller | E1 - Scrolling | Scratch Tutorial
griffpatch
16 Top Down Scroller | Part 2 | Enemy AI
Top Down Scroller | Part 2 | Enemy AI
griffpatch
17 Top Down Scroller | Part 3 | Enemy Clones & List
Top Down Scroller | Part 3 | Enemy Clones & List
griffpatch
18 Top Down Scroller | Part 4 | Live Die Repeat (Game Over)
Top Down Scroller | Part 4 | Live Die Repeat (Game Over)
griffpatch
19 Top Down Scroller | Part 5 | You've Won!
Top Down Scroller | Part 5 | You've Won!
griffpatch
20 Cloud Game Tutorial | Part 1 | The Basics
Cloud Game Tutorial | Part 1 | The Basics
griffpatch
21 Cloud Game Tutorial | Part 2 | Encoding and Decoding
Cloud Game Tutorial | Part 2 | Encoding and Decoding
griffpatch
22 Scratch 3 Dev Tools Browser Extension by griffpatch
Scratch 3 Dev Tools Browser Extension by griffpatch
griffpatch
23 Cloud Game Tutorial | Part 3 | Multiplayer
Cloud Game Tutorial | Part 3 | Multiplayer
griffpatch
24 Scrolling Platformer Tutorial | Part 9 | Momentum
Scrolling Platformer Tutorial | Part 9 | Momentum
griffpatch
25 Scrolling Platformer Tutorial | Part 10 | Wall Jumping
Scrolling Platformer Tutorial | Part 10 | Wall Jumping
griffpatch
26 Cloud Game Tutorial | Part 4 | Auto Game Joining
Cloud Game Tutorial | Part 4 | Auto Game Joining
griffpatch
27 Game Preview - "Getting Over It" with Griffpatch - A fan recreation in Scratch
Game Preview - "Getting Over It" with Griffpatch - A fan recreation in Scratch
griffpatch
28 Speed Run with Outtakes | Getting Over It | 4 minutes 30 seconds
Speed Run with Outtakes | Getting Over It | 4 minutes 30 seconds
griffpatch
29 Griffpatch's Live Stream
Griffpatch's Live Stream
griffpatch
30 MMO Platformer Speedrun Challenge
MMO Platformer Speedrun Challenge
griffpatch
31 Appel Platformer | Scratch Game Blog
Appel Platformer | Scratch Game Blog
griffpatch
32 Cloud Game Tutorial | Part 5 | Smooth Movement
Cloud Game Tutorial | Part 5 | Smooth Movement
griffpatch
33 How to Design a Level for Appel
How to Design a Level for Appel
griffpatch
34 Fastest Appel Speedruns | Jan 2021
Fastest Appel Speedruns | Jan 2021
griffpatch
35 Tile Scrolling Platformer (Mario) | 1. Setup
Tile Scrolling Platformer (Mario) | 1. Setup
griffpatch
36 Tile Scrolling Platformer | 2. Grid List
Tile Scrolling Platformer | 2. Grid List
griffpatch
37 Tile Scrolling Platformer | 3. Tile Collisions
Tile Scrolling Platformer | 3. Tile Collisions
griffpatch
38 Tile Scrolling Platformer | 4. Platforming Scripts
Tile Scrolling Platformer | 4. Platforming Scripts
griffpatch
39 Tile Scrolling Platformer | 5. The Level Editor
Tile Scrolling Platformer | 5. The Level Editor
griffpatch
40 Tile Scrolling Platformer | 6. Level Codes
Tile Scrolling Platformer | 6. Level Codes
griffpatch
41 Tile Scrolling Platformer | 7. Drop Through Platforms
Tile Scrolling Platformer | 7. Drop Through Platforms
griffpatch
42 How to make Physics in Scratch | Full Tutorial
How to make Physics in Scratch | Full Tutorial
griffpatch
43 Tile Scrolling Platformer | 8. Enemy Clones
Tile Scrolling Platformer | 8. Enemy Clones
griffpatch
44 Simple Pathfinding Tutorial
Simple Pathfinding Tutorial
griffpatch
45 Tile Scrolling Platformer | 9. Enemies in Level Editor
Tile Scrolling Platformer | 9. Enemies in Level Editor
griffpatch
46 Simple Maze Generation | Scratch Tutorial
Simple Maze Generation | Scratch Tutorial
griffpatch
47 Tile Scrolling Platformer | 10. Mystery Blocks
Tile Scrolling Platformer | 10. Mystery Blocks
griffpatch
48 Simple Car Steering Simulation | Scratch Tutorial
Simple Car Steering Simulation | Scratch Tutorial
griffpatch
49 Simple Background Scrolling Tutorial
Simple Background Scrolling Tutorial
griffpatch
50 Tile Scrolling Platformer | 11. Death, Background & Sound
Tile Scrolling Platformer | 11. Death, Background & Sound
griffpatch
51 Mid Week Update & Channel Membership
Mid Week Update & Channel Membership
griffpatch
52 Simple Grid List Tutorial with Image Scanning
Simple Grid List Tutorial with Image Scanning
griffpatch
53 Tile Scrolling Platformer | 12. Auto Arranging Tiles
Tile Scrolling Platformer | 12. Auto Arranging Tiles
griffpatch
54 Code a Fun Space Shooter Game 🚀 | 1. Move & Shoot | Scratch Tutorial
Code a Fun Space Shooter Game 🚀 | 1. Move & Shoot | Scratch Tutorial
griffpatch
55 Space Shooter 2 - Enemy Collisions
Space Shooter 2 - Enemy Collisions
griffpatch
56 Tile Scrolling Platformer | 13. Level Progression & Editor Improvements
Tile Scrolling Platformer | 13. Level Progression & Editor Improvements
griffpatch
57 Space Shooter 3 - Camera Shake & FX
Space Shooter 3 - Camera Shake & FX
griffpatch
58 Tile Scrolling Platformer | 14. Sloping Tiles
Tile Scrolling Platformer | 14. Sloping Tiles
griffpatch
59 Pathfinding a Maze using Lists
Pathfinding a Maze using Lists
griffpatch
60 Tile Scrolling Platformer | 15. Crouch & Slide
Tile Scrolling Platformer | 15. Crouch & Slide
griffpatch

Related Reads

Up next
I Created An AI Auto-Coder That ACTUALLY Makes Working Code!
Making Made Easy
Watch →