How to Make Sans’s Battle from Undertale in Scratch ep.3

How to Make Sans’s Battle from Undertale in Scratch ep.3
ok-scratch
Part 3 of making Undertale: we’re adding Sans’s iconic Gaster Blaster! It’s trickier than the bone attack, with complex timing and patterns. Let’s tackle this challenging move together!
Starter
Projects
Starter Project
Sample
none
Difficulty
Tags

Make sure to jot down the URL of your Scratch project in progress. It’s a lifesaver when you’re ready to dive back in.

LOADING...

This record is saved on the computer you’re currently using. So, if you switch to a different computer, you won’t see it there.

It’s time for Part 3 of how to make Undertale! Now we’re finally implementing Sans’s signature attack: the Gaster Blaster. It just wouldn’t feel like Sans without it! The Gaster Blaster requires more complex timing than the bone attack, with multiple patterns to manage. This is one of the toughest attacks in the Undertale series, so let’s carefully build it together!

Sprite 'Admin'

First, let’s add the Gaster Blaster activation to the attack sequence in the admin sprite!

Open 'Admin' sprite.

Message 'Gaster Blaster'

Wait for 4 seconds and broadcast 'Gaster Blaster'.

Sprite 'Gaster Blaster'

OK, open 'Gaster Blaster' sprite!

First of all, when the green flag is clicked, go to front layer and hide.

Let’s create the coding for when the "Gaster Blaster" message is received!

Block Definition '_Get ready'

Create a new block definition named '_Get ready' ( or _Get Ready) that runs without screen refresh.

Place this block first.

Variable 'clone'

Create a variable named 'clone' for this sprite only.

Initialize this to 1.

Place the repeat block. The number "4" represents the number of Gaster Blasters that will appear.

Create clone of myself inside.

Change 'clone' by 1.

Clone

Place the hat block of the clone coding.

Block Definition 'Fire Gaster Blaster 1'

Create a block definition named 'Fire Gaster Blaster 1'.

In this block definition, we’ll implement the initial movement for the Gaster Blaster. This first movement makes the Gaster Blasters appear at the four corners of the square and attack in an X pattern.

Place 'if' block and insert the expression 'clone = 1' into the condition.

Set X to -165, Y to 50 and the direction to 90.

Block Definition 'Set Position'

Since this process is for setting the initial position of the Gaster Blasters, let’s group it together in a block definition called "Set Position."

Move all the coding from "Fire Gaster Blaster 1" over to "Set Position".

Replace each value with the appropriate arguments.

In "Fire Gaster Blaster 1," call this block definition and pass the initial position and starting angle for each Gaster Blaster as arguments.

  • clone 1
    • X: -165
    • Y: 50
    • DIR: 90
  • clone 2
    • X: -80
    • Y: 135
    • DIR: 180
  • clone 3
    • X: 165
    • Y: -110
    • DIR: -90
  • clone 4
    • X: 80
    • Y: -240
    • DIR: 0

Set size to 150%.

Set the costume to "close." This is the Gaster Blaster’s initial costume, as shown in the screenshot below.

Then show.

Preview

To test codings so far, click 'when I receive Gaster Blaster' block.

Then you will see the Gaster Blasters like below!

Neat! Keep coding!

Repeat moving 3 steps 10 times to make it move forward gradually.

Block Definition 'Draw Fire'

Since the Gaster Blaster’s appearance is the same for all attack patterns, let’s group it into a block definition.

Place this block after the repeat.

In the definition, switch costume to 'open' and wait for 0.5 seconds.

Next, switch the costume to "blaster narrow" and wait 0.05 seconds.

Switch the costume to "blaster normal" and wait 0.05 seconds.

Switch the costume to "blaster wide" and wait 0.5 seconds.

Switch the costume back to "blaster normal" and wait 0.05 seconds.

Switch the costume back to "close" as the final costume.

Repeat moving -10 steps 5 times to create a retreat effect, then hide.

Preview

Let's click the event block to test quickly!

Voilà! The first Gaster Blaster attack is complete! Cool!

Block Definition 'Fire Gaster Blaster 2'

Where there's a 1, there’s got to be a 2, right? So let’s start coding "Fire Gaster Blaster 2." And yes, we’re planning to make it up to 3!

Use this block right after 'Fire Gaster Blaster 1'.

Duplicate all blocks of 'Fire Gaster Blaster 1'.

Attach it to 'Fire Gaster Blaster 2' and remove the repeat block.

Adjust the positions and directions like below.

  • clone 1
    • X: -130
    • Y: 90
    • DIR: 135
  • clone 2
    • X: 130
    • Y: 90
    • DIR: -135
  • clone 3
    • X: -130
    • Y: -160
    • DIR: 45
  • clone 4
    • X: 130
    • Y: -160
    • DIR: -45

Oops, don’t forget to place the "wait 0.5 seconds" block between the "show" and "Draw Fire" blocks.

Preview

Cool! The consecutive Gaster Blaster attacks are coming together!

Fire Gaster Blaster 1 again

Block Definition 'Fire Gaster Blaster 3'

Place this block in the sequence under the "when I start as a clone" block.

Adjust each value in the "Set Position" block arguments as shown below.

  • clone 1
    • X: -165
    • Y: -10
    • DIR: 90
  • clone 2
    • X: -165
    • Y: -50
    • DIR: 90
  • clone 3
    • X: 165
    • Y: -10
    • DIR: -90
  • clone 4
    • X: 165
    • Y: -50
    • DIR: -90

Preview

Click the event blocks to test quickly.

Fantastic! The Gaster Blaster has arrived!

Thank you for reading! Thank you for reading!
Bookmark and share this article, if you like.

Scratch Games

    • You can find popular scratch projects with reviews.