Scrolling Platformer Tutorial | Part 6 | Danger Sprites (Bug fix)

griffpatch · Beginner ·🏗️ Systems Design & Architecture ·7y ago

Key Takeaways

Scratch game development with a focus on fixing a bug related to danger sprites in a scrolling platformer game

Full Transcript

hi I'm Chris patch welcome back to my scrolling platformer tutorial for scratch now you might noticed that this little level has changed a bit I was going to look at doing Edney exits today but as it turns out it's been reported to me that there's been a bit of an issue with the currents platform as it is and I'm going to show you that right here what we've discovered is that the red color of course was the lava and that would kill you but it actually kills you when it shouldn't so for example if I walk over here to the edge of this platform and then jump I die if I walk over this Y bit here and I jump I die now why is that well the problem we're having here is that this way the scripts work at the moment is that I detect the touching lava after I move the player but before I move them out of a platform so here I'm travelling up into the air coming down really fast and going through the platform touching the red and dying before it moves me up to say I'm on top of the platform again oh and that's a bit of a shame because that makes the scripts a lot more tricky and I was trying to avoid having to have do any tricky scripting so today I'm going to show you how I would go about fixing this and it really sits how I would have coded it myself anyway had I been coding this platform of myself but I'll say I was trying to make it a little bit easier but so sorry about that I'm gonna have to go a little bit harder you'll note we are using scratch to e now which is come around as that's quite exciting I've had to make this screen a little bit bigger for this YouTube tutorial because if it was any smaller you wouldn't have much size for my scripts so I have added in a little bit of extra red on the platform of sprites as you can see just for testing purposes only so you don't bother buddy knows but you can add them in if you like just so you can test this feature happening on your scratch projects to write to fix this what are we going to do is we're going to split our platform as sprites into two different sprites one for the platforms and one for the lava or the dangerous areas so let me just stop this project so if you might click on platforms and duplicate them move those together like that and then we name it as danger like that okay now what we need to do now is in the danger sprites go to the costumes and what we need to do in each of the different costumes will live and pass the level we've got to remove everything except for the bits that are dangerous so just click in and delete pressing delete key does the trick next level delete these bits it SAS blank sprite but that's fine next one and delete these bits so we are now left with only the bits that kill you in the danger sprite so go back to the platform sprite and then here we need to do the opposite we need to only delete the bits that kill you so if we delete the red bits go to the next costume note that all stays I only delete the red bit okay so now we've called completely split out the platforms from the bits that hurt you okay let's just run that just make sure that it is running so here we are now you can see we can still see both the red bits and the platform's just as if it had been a single costume now the reason it's working is because we've just duplicated up this code and all of the scripts for positioning each of those level pieces and the danger pieces are exactly the same so it's showing both sets so what we'll find is that we still die if we jump here because we're still touching the red so we need to change the scripts now not to be the touching red anymore so let's stop that so this is in our player sprite within the define change player X custom block we've got this test die call now we no longer want that so right click on test die and say delete block beautifully deletes that little block them within there which is a new feature of scratch 3 which is very useful rather than having to rearrange things a lot now we wanted the same in the change player why find that it is say get rid of the test die right-click it delete block okay so now we shouldn't be the die at all if we there we go so now we fall straight through and he read because weird is no longer platforms and all are touching scripts are touching platforms so it's no longer looking at those at all which is great so we can have fall through lava so what we need to do now is add back in a test that actually checks that we're touching a real lava so if we go along to our script called test die it used to be touching color red so we're going to change that get rid of the touching color red and we're going to be having touching illnesses touching mouse pointer change it to be danger so if we touch any danger sprites then we're going to set the exit now at the moment we're no longer using this test die because we just removed it so we need to put that back in but this is the critical change because we can put it in after we've changed pair Y here in the tick script so let's just get that scroll out of the way I'm gonna put it in just here so we want to go to my blocks and do a test I just there then put the scrolling back in so what's gonna happen now is it's gonna move our player we're gonna be pushed back out of the platform like we want to be and only then does it test to see if we're touching any larva still let's give that a run so first off there we go we died but let's try on the edge jump jump fine yeah yeah we're just fine so I think that is going to solve all our problems and it's quite nice because previously when we touch lava we would only be on the surface of the lava but now we actually can sink in a bit before we die which I quite like anyway so that's great okay so that solves the problem and it's not too difficult to implement but here's the slight problem now when you're designing your levels you've got to design them in the platform script let's try another one duplicate a piece of platform level I'm going to call it oh it's all the way of course it's labeled it already layer 1 4 so we could draw our new bit of level in here just like we would have done in scratch - let me design it or honky-dory like this copy/paste ok so here's our new level but we want larvae in this one too but of course when we draw our lover here it's only going to be temporary he wearing an adroit in here and then we're going to have to move it into the danger sprite instead often it's useful to draw it in here even so because you're drawing it with the other part of the level visible otherwise if you're doing in here doing it blind and it's very hard to know if you're drawing in to my place so there's that the good thing about now the way we've done this lava is it doesn't have to be red anymore you can actually have any color you like so let's choose a slightly different color just for some fun a slightly dangerous bluey dark purple this we can test to make sure it works first let's add in a new clone for this new bit of level and we'll add it and just like we used to do and I run that let's make sure that our new bit of level has appeared here it is good but of course purple is not going to kill us at all in fact purple is at the moment a solid platform because it's in the platforms and then we no longer want anything in platforms that we can't walk on it's going to kill you or anything so we need to stop a project and we need to move our costume for the death into the danger so go into your costumes we need to copy this costume we've just drawn into danger so drop it into danger then into danger another dangerous sprite we can go and look what we can now do is remove everything that isn't dangerous from that sprite costume like that and back into platforms and remove the dangerous bit so in the platform's we've got the new bit of level the danger we've got the danger that's almost everything but remember the scripts also need changing so if you go into our scripts again we need to add this extra clone into the danger sprite as well as this one so let me just drop that into the dangerous bright and you want to put that into the here - so these scripts always have to stay the same in the two different stripes the platforms and the danger so that they're both being created in the same way let's run that and make sure it works there we go and if we go in there we go we die and that is it for this tutorial sorry it wasn't on know what I was going to do it on but this is a pretty good fix that we need to do to make this game work more robustly you can choose whether you want to do this or whether you don't because you programs they still work without these changes but there are cases where you will get player dying if you're not careful and design the level in a way that avoids it so that concludes this tutorial I hope you understand that and I hope you'll also understand that now we can do more interesting death sprites because they can be all different colors too and that can make your level look a lot more fun because you can design it any way you like so tune in next time bye now

Original Description

This is part 6 of this tutorial series where we are building a scrolling platformer game together in Scratch. Part 7: https://youtu.be/vsOxtvIF9Qk - Part 1: https://youtu.be/sebnyhBsXug In this tutorial we fix an unintended issue where a player can die from lava that should not have caused the player to die. We end up with an improved platforming engine, but at the cost of a little extra work when designing levels. 🚀 *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
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from griffpatch · griffpatch · 9 of 60

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
▶ 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

This tutorial series covers building a scrolling platformer game in Scratch, with a focus on fixing a bug related to danger sprites. By following along, viewers can learn how to design and implement game mechanics, fix bugs, and create a fully functional platformer game.

Key Takeaways
  1. Create a new Scratch project
  2. Design the game layout
  3. Implement player movement
  4. Add danger sprites
  5. Fix the bug related to lava
  6. Test the game
💡 Fixing bugs in a game is an essential part of the game development process, and can be done by identifying the issue, isolating the problem, and implementing a solution.

Related Reads

📰
I overloaded Slack’s Job Queue — and what it taught me about scale
Learn from a real-world example of overloading Slack's Job Queue and discover key concepts for scaling systems, including backfills, thundering herds, and fan-out.
Medium · Programming
📰
I Thought Senior Java Interviews Were About Java. Then Every Question Turned Into aDatabase Question
Senior Java interviews often focus on database concepts, highlighting the importance of understanding data storage and retrieval in software development
Medium · Programming
📰
The last scan is not the last mile: modelling the carrier handover in shipment tracking
Learn to model carrier handovers in shipment tracking to improve logistics accuracy
Dev.to · 24hTrack
📰
From Coder to Architect: Engineering the System One AI & MCP Gateway Stack
Learn how to shift from coding to architecting systems, focusing on structure over syntax, and why this matters for AI and MCP Gateway Stack development
Dev.to AI
Up next
Linux Command Every Engineer Should Use!
KodeKloud
Watch →