Goodbye Sweet Enemy - BONUS EPISODE | Scratch Platformer Tutorial e14
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Burrow Blitz - A game by Griffpatch
griffpatch
Burrow Blitz Level 1 Speed Run!
griffpatch
Scratch Messaging Extension (for chrome & firefox)
griffpatch
Scrolling Platformer Tutorial | Part 1 | Get Scrolling
griffpatch
Scrolling Platformer Tutorial | Part 2 | Gravity
griffpatch
Scrolling Platformer Tutorial | Part 3 | Platform Detection
griffpatch
Scrolling Platformer Tutorial | Part 4 | Off Screen Sprites and Player Death
griffpatch
Scrolling Platformer Tutorial | Part 5 | Collectables
griffpatch
Scrolling Platformer Tutorial | Part 6 | Danger Sprites (Bug fix)
griffpatch
Scrolling Platformer Tutorial | Part 7 | Exit Portal
griffpatch
Scratch 3 | Box2d | Physics Extension
griffpatch
Scrolling Platformer Tutorial | Part 8 | Vertical Scrolling
griffpatch
Zombie Cube | Speedrun challenge
griffpatch
Scratch 3 | Physics Extension | Version 2
griffpatch
Top Down Scroller | E1 - Scrolling | Scratch Tutorial
griffpatch
Top Down Scroller | Part 2 | Enemy AI
griffpatch
Top Down Scroller | Part 3 | Enemy Clones & List
griffpatch
Top Down Scroller | Part 4 | Live Die Repeat (Game Over)
griffpatch
Top Down Scroller | Part 5 | You've Won!
griffpatch
Cloud Game Tutorial | Part 1 | The Basics
griffpatch
Cloud Game Tutorial | Part 2 | Encoding and Decoding
griffpatch
Scratch 3 Dev Tools Browser Extension by griffpatch
griffpatch
Cloud Game Tutorial | Part 3 | Multiplayer
griffpatch
Scrolling Platformer Tutorial | Part 9 | Momentum
griffpatch
Scrolling Platformer Tutorial | Part 10 | Wall Jumping
griffpatch
Cloud Game Tutorial | Part 4 | Auto Game Joining
griffpatch
Game Preview - "Getting Over It" with Griffpatch - A fan recreation in Scratch
griffpatch
Speed Run with Outtakes | Getting Over It | 4 minutes 30 seconds
griffpatch
Griffpatch's Live Stream
griffpatch
MMO Platformer Speedrun Challenge
griffpatch
Appel Platformer | Scratch Game Blog
griffpatch
Cloud Game Tutorial | Part 5 | Smooth Movement
griffpatch
How to Design a Level for Appel
griffpatch
Fastest Appel Speedruns | Jan 2021
griffpatch
Tile Scrolling Platformer (Mario) | 1. Setup
griffpatch
Tile Scrolling Platformer | 2. Grid List
griffpatch
Tile Scrolling Platformer | 3. Tile Collisions
griffpatch
Tile Scrolling Platformer | 4. Platforming Scripts
griffpatch
Tile Scrolling Platformer | 5. The Level Editor
griffpatch
Tile Scrolling Platformer | 6. Level Codes
griffpatch
Tile Scrolling Platformer | 7. Drop Through Platforms
griffpatch
How to make Physics in Scratch | Full Tutorial
griffpatch
Tile Scrolling Platformer | 8. Enemy Clones
griffpatch
Simple Pathfinding Tutorial
griffpatch
Tile Scrolling Platformer | 9. Enemies in Level Editor
griffpatch
Simple Maze Generation | Scratch Tutorial
griffpatch
Tile Scrolling Platformer | 10. Mystery Blocks
griffpatch
Simple Car Steering Simulation | Scratch Tutorial
griffpatch
Simple Background Scrolling Tutorial
griffpatch
Tile Scrolling Platformer | 11. Death, Background & Sound
griffpatch
Mid Week Update & Channel Membership
griffpatch
Simple Grid List Tutorial with Image Scanning
griffpatch
Tile Scrolling Platformer | 12. Auto Arranging Tiles
griffpatch
Code a Fun Space Shooter Game 🚀 | 1. Move & Shoot | Scratch Tutorial
griffpatch
Space Shooter 2 - Enemy Collisions
griffpatch
Tile Scrolling Platformer | 13. Level Progression & Editor Improvements
griffpatch
Space Shooter 3 - Camera Shake & FX
griffpatch
Tile Scrolling Platformer | 14. Sloping Tiles
griffpatch
Pathfinding a Maze using Lists
griffpatch
Tile Scrolling Platformer | 15. Crouch & Slide
griffpatch
Related Reads
📰
📰
📰
📰
I Uninstalled Vue DevTools. My Tests Became the Better Debugger.
Dev.to AI
EARS Requirements: Writing Specs That AI Can Actually Follow
Dev.to AI
My AI coding agent reverted a core feature in one buried line — and its commit messages lied about it
Dev.to · Masih Maafi
How I Improved Code Quality with AI and Static Analysis (SonarQube Cloud + MCP)
Dev.to · SixSet
🎓
Tutor Explanation
DeepCamp AI