Lecture: 14 | WATER BOAT GAME IN SCRATCH | GAME DEVELOPMENT | SCRATCH TUTORIAL

Block Programming
18 Jun 202114:41

Summary

TLDRThis tutorial video guides viewers on creating a boat water game in Scratch 3.0. It covers setting up the stage, adding backdrops, and creating variables like score. The video demonstrates how to animate sprites, such as rocks and speed lines, and includes coding for game mechanics like spawning, movement, and collision detection. It also details the boat's controls and game over conditions, concluding with playing the game in full screen mode.

Takeaways

  • ๐Ÿš€ The video is a tutorial on creating a boat water game in Scratch 3.0.
  • ๐Ÿ” It starts with removing the default cat sprite and choosing a blue sky backdrop for the stage.
  • ๐ŸŽจ The creator adds a second backdrop for the game mode, which is a red color-filled stage.
  • ๐Ÿ“ A 'score' variable is introduced to keep track of the game's progress.
  • โฑ The score increases by one every second in a loop, starting from zero when the game begins.
  • ๐Ÿž๏ธ Border sprites are added and programmed to move to the center of the stage and stay on a back layer.
  • ๐Ÿ—ฟ Rock sprites are created, cloned, and made to move downwards from a random y-position at the top of the screen.
  • ๐ŸŒŠ Additional sprites representing water waves or speed lines are created by duplicating and modifying the rock sprite's costume.
  • ๐Ÿ›ถ A board sprite is added with multiple costumes representing different orientations of the boat.
  • โ›” The game ends by switching to a 'game over' backdrop if the boat touches rocks or borders, with movement controls tied to arrow keys.
  • ๐Ÿ”„ The boat sprite changes costumes and moves in response to left and right arrow key presses, with a check to ensure it moves in the correct direction.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is to demonstrate how to create a boat water game in Scratch 3.0.

  • Why does the video start with removing the default cat sprite?

    -The video starts with removing the default cat sprite because it is not needed for the boat water game project being demonstrated.

  • What backdrop does the video suggest to choose for the game?

    -The video suggests choosing a blue sky backdrop for the game.

  • How many backdrops are created in the video for the project?

    -Two backdrops are created in the video for the project: one is a blue sky and the other is a game over screen colored red.

  • What is the purpose of the 'score' variable in the game?

    -The 'score' variable is used to keep track of the player's score in the game, which increases every second.

  • How does the video describe creating border lines for the game?

    -The video describes creating border lines by using the 'paint' option to draw rectangles, filling them with green color, and then duplicating and positioning them on the stage.

  • What sprite is used to represent rocks in the game?

    -The video uses a rock sprite found in the Scratch library, resized to 50% of its original size.

  • How does the rock sprite move in the game?

    -The rock sprite moves by creating clones that appear at random positions at the top of the screen and then move downwards.

  • What is the purpose of the 'speed lines' sprite in the game?

    -The 'speed lines' sprite is used to create the illusion of movement or waves in the water for the boat to navigate through.

  • How does the video handle the boat sprite's interaction with rocks and borders?

    -The video uses 'if' statements to check if the boat sprite touches rocks or borders, and if so, it changes the backdrop to 'game over' and stops the game.

  • What keyboard inputs are used to control the boat sprite's movement?

    -The right and left arrow keys are used to control the boat sprite's movement, with the right arrow moving it to the right and the left arrow moving it to the left.

  • How does the video ensure the boat sprite moves smoothly on the screen?

    -The video ensures smooth movement by using 'if else' statements to switch costumes and move the sprite in steps when the arrow keys are pressed.

  • What happens when the boat sprite reaches the bottom of the screen?

    -When the boat sprite reaches the bottom of the screen, it is programmed to delete the clone and return to the top, creating a continuous movement effect.

  • How does the video encourage viewers to engage with the content?

    -The video encourages viewers to subscribe to the channel, like the video, and watch more informative videos for further learning.

Outlines

00:00

๐Ÿš€ Introduction to Creating a Boat Water Game in Scratch 3.0

The video begins with an introduction to creating a boat water game using Scratch 3.0. The presenter removes the default cat sprite and selects a blue sky backdrop. They then create a second backdrop for the game mode, changing its color to red. A variable for the score is added, and the presenter explains how to set the score to zero when the flag is clicked and increment it every second. The addition of border sprites as game elements is also covered, including creating and positioning them on the stage.

05:02

๐ŸŒŠ Developing Rock Sprites and Movement Mechanics

In this section, the script describes the process of adding and coding rock sprites to move across the screen. The presenter explains how to create clones of the rock sprite that appear at random positions at the top of the screen and move downwards. They detail the use of comparison operators to delete the clone when it reaches a certain y-position, simulating the rock moving out of the screen. The presenter also demonstrates testing the code to ensure the rocks move and clone as expected.

10:03

๐Ÿž๏ธ Adding Water Waves and Speed Lines for Visual Effects

The presenter moves on to enhance the game's visual appeal by adding water waves or speed lines. They duplicate the rock sprite and rename it to 'speed lines,' then change its costume to create a wavy pattern. The process of drawing and positioning these lines on the screen is explained. The script also covers how to make these speed lines move across the screen in different positions to simulate water movement, and the presenter runs the game to show the visual effect in action.

โ›ต๏ธ Implementing the Board Sprite and Control Mechanics

The final part of the script focuses on adding a board sprite and coding its behavior. The presenter uploads different costumes for the board and adds code to switch between them based on user input. They explain how to make the board move to the front layer, position it centrally, and check for collisions with rocks or borders, which trigger a game over state. The movement of the board is controlled by the keyboard's arrow keys, with the right arrow moving the board right and the left arrow moving it left. The presenter concludes by testing the full-screen mode of the game, showcasing the board's smooth movement and collision detection.

Mindmap

Keywords

๐Ÿ’กScratch 3.0

Scratch 3.0 is a programming language and online community directed primarily at children where users can program and share interactive stories, games, and animations. In the context of the video, Scratch 3.0 is the platform used to create a boat water game, indicating the software's educational and creative purpose.

๐Ÿ’กCode Area

The code area in Scratch 3.0 is the workspace where users can drag and drop programming blocks to script their sprites' behavior. The script mentions the code area as the place where the user begins to script their game, highlighting the importance of this space in the game development process.

๐Ÿ’กSprite

In the context of Scratch, a sprite represents an object or character in the game that can be programmed to perform various actions. The video script refers to removing the default cat sprite and adding new sprites like borders and rocks, which are essential for the game's mechanics.

๐Ÿ’กBackdrop

A backdrop in Scratch is a static image that serves as the background for a project. The script describes choosing a blue sky backdrop and creating a game over backdrop, which are crucial for setting the scene and context of the game.

๐Ÿ’กVariable

Variables in programming, including Scratch, are used to store information that can change, such as scores or player positions. The script mentions creating a 'score' variable, which is essential for tracking the player's progress within the game.

๐Ÿ’กEvent Block

Event blocks in Scratch are used to trigger actions in response to certain events, such as a mouse click or a flag being clicked. The script describes using an 'when flag clicked' event block to initialize the game, which is a common starting point for Scratch projects.

๐Ÿ’กForever Block

The forever block in Scratch is a control block that allows a set of actions to repeat indefinitely. The script uses a forever block to increase the score every second, demonstrating the block's use in creating continuous game mechanics.

๐Ÿ’กClone

In Scratch, cloning is the process of creating a copy of a sprite. The script describes creating clones of the rock sprite to add dynamic elements to the game, such as obstacles that move and challenge the player.

๐Ÿ’กBorder

Borders in the context of the game described in the script are likely to be the edges of the game area. The script mentions adding border sprites and programming them to reset the game when the boat sprite touches them, which is a common way to define game boundaries.

๐Ÿ’กCostume

A costume in Scratch refers to the appearance of a sprite, which can be changed to animate the sprite or to represent different states. The script discusses uploading and switching costumes for the boat sprite to reflect its movement and orientation.

๐Ÿ’กControl Block

Control blocks in Scratch are used to manage the flow of a program, such as repeating actions or responding to conditions. The script uses control blocks like 'if' and 'delete this clone' to handle game logic, such as ending the game when the boat hits a rock.

๐Ÿ’กLayer

Layers in Scratch determine the order in which sprites are displayed, with sprites on higher layers appearing in front of those on lower layers. The script mentions sending sprites to the back layer to ensure they appear behind other elements, which is important for visual hierarchy in the game.

๐Ÿ’กGame Over

In gaming, 'game over' typically signifies the end of a game session, often triggered by the player losing all lives or failing to meet an objective. The script describes a condition where the backdrop switches to 'game over' when the boat sprite touches rocks or borders, indicating the game's end.

Highlights

Introduction of a tutorial on creating a boat water game in Scratch 3.0.

Removing the default cat sprite from the project.

Adding a blue sky backdrop to set the scene.

Creating a game mode backdrop with a red color.

Duplicating and renaming the backdrop for different game stages.

Introducing a score variable for the game.

Setting the initial score to zero when the game starts.

Incrementing the score every second with a forever block.

Adding border sprites to define the game area.

Creating and positioning border lines using the paint editor.

Coding the border sprite to move to the center of the stage.

Adding a rock sprite and setting its movement path.

Creating clones of the rock sprite to add challenge.

Coding the rock sprite to move downwards and delete clones upon reaching the bottom.

Introducing speed lines to enhance the game's visual effects.

Customizing the speed lines costume with random lines for a dynamic look.

Adding a board sprite and coding its movement based on keyboard inputs.

Implementing collision detection between the boat and obstacles to end the game.

Finalizing the game setup with full screen mode for an immersive experience.

Encouraging viewers to subscribe and like for more informative content.

Transcripts

play00:00

[Music]

play00:21

in this video i will show you how to

play00:23

make a boat water game in scratch 3.0

play00:26

so let's start this is my code this is

play00:29

my

play00:30

code area this is my stage and i don't

play00:32

need the sprite so i will remove this uh

play00:35

cat sprite so just remove it okay good

play00:38

now i have to add my backdrop so click

play00:41

choose a backdrop

play00:43

and i am choosing a blue sky backdrop so

play00:45

i am clicking on it

play00:47

okay good now just click on back uh

play00:50

backdrop tape

play00:51

and remove this backdrop one and i am

play00:54

choosing

play00:55

i am filling this color just check this

play00:59

and click on this paint and color it

play01:03

okay now i am right click on it and

play01:06

duplicate it

play01:07

so i will rename it as a game or i need

play01:10

to backdrop for my project

play01:12

one is blue sky and another is game mode

play01:15

so i will here i will type

play01:18

game or select all

play01:22

and make it a color red now increase its

play01:25

size

play01:27

that's great okay now i have

play01:30

created two backdrops for my project now

play01:33

for

play01:34

my backdrop i will add some code so for

play01:37

this

play01:38

i need a variable a score for my project

play01:41

so click

play01:42

on variables and click on my make a

play01:45

variable

play01:47

and here i will rename as a score

play01:50

okay good click enter so i have added my

play01:53

score into my project

play01:55

so click on this backdrop and here i

play01:58

will add some code for my score block

play02:00

score option so just click on events

play02:04

and click on this when flag clicked

play02:07

so initially when i click on flag so the

play02:10

score will be zero so set my score to

play02:15

zero now foreverly the score will be

play02:17

increasing

play02:18

after one second one by one so for this

play02:21

i will choose a forever block

play02:23

and in this i will choose i change score

play02:27

by one

play02:29

and after one second

play02:32

waits one second so when i click on flag

play02:36

so it will change score one by one sorry

play02:39

uh click on this change score by one now

play02:42

when i click on flag

play02:43

so it will changing score one by one

play02:46

okay good

play02:47

now i'm adding another uh sprite

play02:51

so my another sprite will be border

play02:54

lines

play02:54

into my this project so for this i will

play02:57

need a create

play02:58

a paint choose a sprite and click on

play03:02

paint option so here i will add some two

play03:05

borders

play03:06

into my project one here and another one

play03:09

is

play03:10

dual so for this i will choose click on

play03:13

this rectangle option

play03:14

just click on this and click this fill

play03:17

option

play03:18

that is uh green

play03:21

okay good so it will be my

play03:24

and the size will this for me that is it

play03:30

sorry two okay

play03:33

now i am filling it just right click and

play03:36

drag this okay good

play03:39

now same to same copied it

play03:43

just copied it okay good and now paste

play03:47

it

play03:47

that's great now just put this into

play03:51

this in this position that's great

play03:54

so okay good so for this uh

play03:57

option that is sprite i will rename it

play04:00

this is

play04:01

that is border so these are the border

play04:04

for my

play04:05

project now click on code

play04:08

so click on code just whenever i click

play04:11

flag has been clicked so this position

play04:15

will be at the center

play04:16

at the center of my stage so for this

play04:19

i will just add this block that is go to

play04:23

x0 y0 so just click on flag

play04:26

so you can see this this border are in

play04:29

the accurate position

play04:31

now these are on the front so we have to

play04:34

go back to one layer so just

play04:39

there's an option that is go back

play04:42

back layer okay great now we have to add

play04:46

our

play04:46

next sprite that is rock so just click

play04:48

on this to sprite

play04:50

and here i will search a rock sprite

play04:53

that is click on it now we have to

play04:56

resize it just click on this size option

play04:59

and we have to reduce your size to 50

play05:02

that's great now we have to add some

play05:04

block for our rox code

play05:06

so it will move from this position into

play05:08

this direction

play05:09

so for this we have to click on events

play05:12

and

play05:13

we have to uh make different copies of

play05:17

this sprite so for this we need to hide

play05:19

this

play05:20

original sprite and we have to make or

play05:24

clones of this uh object that is

play05:27

rock sprite so we have to create clone

play05:30

of my cell

play05:31

after every one second so after every

play05:34

one second it will create this clone

play05:36

when whenever clone has been created now

play05:39

we have to

play05:40

do when i start as a clone that is we

play05:44

have to go to back one layer

play05:46

so just click this go to back one layer

play05:49

that's great now we have to show this

play05:52

copy show this clone

play05:54

and it will go to the random position

play05:57

it will come from this position or from

play05:59

this position or from this position

play06:01

and we have to set its y position it

play06:04

will come from this top of this position

play06:06

so we have to set the y position

play06:08

into 180 so

play06:11

we have set the position 180 now we have

play06:14

to set the x position

play06:16

say so it will come from this random

play06:19

direction now

play06:20

from uh the random position for this

play06:23

x position will be uh from

play06:27

minus 190 to 190 that's great

play06:31

now we have to submit some another code

play06:34

for our project that is

play06:36

foreverly it will come from this up

play06:40

direction to lower direction so it will

play06:42

change its

play06:43

y position so we have to click this

play06:46

write this block and we have to change

play06:47

this by

play06:48

minus eight now if for

play06:51

the condition we will apply a condition

play06:53

for this so we

play06:55

whenever uh this rock uh reach this

play06:57

position it will

play06:59

delete this clone so for this we have to

play07:01

add some comparison operators

play07:04

so there is an operator that is right

play07:06

this less than blocked

play07:07

and in this option we have to drag this

play07:11

y position

play07:12

and we have today minus 170

play07:15

that's great now whenever this rock

play07:18

reaches to this position so it will

play07:20

delete this clone

play07:21

so just click on controls and click

play07:23

delete this clone

play07:24

now we have to try our codes so

play07:27

let's uh run it that's great

play07:31

so now it's coming from randomly

play07:32

position and it's creating its clone

play07:34

that's great

play07:35

now we have to make uh another sprites

play07:40

it will be like water waves or speeding

play07:43

lines

play07:43

so for this we don't need a duplicate of

play07:46

this

play07:47

rock side so just right click on it and

play07:49

make a duplicate

play07:51

so great so i have created a rocks so it

play07:54

uh duplicate now just rename it to speed

play07:57

lines

play07:59

speed lines and we have to change its uh

play08:03

costume so just click on the speed lines

play08:06

and click on this costume steps

play08:08

that's great now we have to change its

play08:10

costume

play08:11

we have to make some random lines or for

play08:15

our

play08:15

costume speed lines so just click on

play08:18

this and remove

play08:19

and click on this delete option so we

play08:22

have removed this

play08:23

let's create now we have to draw some

play08:26

lines just like a speed lines

play08:28

so it will like split line two

play08:31

and that's where and it's called we have

play08:34

to

play08:35

write this white color okay and we have

play08:39

to change its

play08:40

position that is outline two and

play08:43

raw we have to draw some lines that's

play08:46

great

play08:48

if you want to zoom it so you can zoom

play08:51

it here from this position

play08:52

and if you want to duplicate it just

play08:55

copy

play08:56

it and paste it that's great so

play08:59

we have added some lines

play09:03

into the center position that's great

play09:07

now we have to click on this flag so it

play09:09

will come into different positions

play09:11

you can see it here that's great you can

play09:15

also make the duplicate again

play09:17

so just click on this copy and

play09:21

you can paste it here again so that's

play09:24

great

play09:25

now you have to run this okay great

play09:30

that's great now we have to add our

play09:33

board sprite in this

play09:34

board sprite we have to do some code so

play09:37

uh

play09:38

the board sprite uh in the bose

play09:40

courtroom are

play09:41

present in this below description you

play09:43

can choose it from

play09:45

the below description okay so we have to

play09:48

choose a board scribe from our

play09:50

gallery that is upload upload option

play09:54

upload sprite

play09:55

so we have to click on uh upload sprite

play09:58

that is

play09:59

up that is great

play10:02

so the up costume had been added now we

play10:04

have to add another costume for our

play10:07

uh board sprite so just click on this

play10:10

upload costume

play10:12

and we have to upload this left uh

play10:14

costumes

play10:15

and we can also upload this its right

play10:18

costume you can also download this

play10:19

costumes from my

play10:21

below description link okay

play10:24

so these three costumes have been added

play10:26

now we have to add some code for this

play10:28

costume that is

play10:29

and we have to rename this uh rename

play10:32

this costume

play10:33

that is boot that's great

play10:36

okay good now you have to click on this

play10:39

board and click on this code tab

play10:41

now now we have to add some code for

play10:43

what uh

play10:44

what of sprites so whenever the flag has

play10:48

been clicked

play10:49

that's great now we have to add some

play10:51

code for

play10:52

both so switch back drop we have to this

play10:55

is our uh

play10:57

switchback drop to a blue sky so

play11:00

whenever we click the black

play11:01

blue square drop has been up now we have

play11:04

to switch the costume

play11:06

switch costume to up so whenever we

play11:08

click so it's cartoon will be in this

play11:10

direction

play11:11

now we have to add some go to front

play11:14

layer

play11:14

so just click this to go to front layer

play11:17

that's great

play11:18

now we have to make in the center

play11:20

position

play11:21

so we have to specify its position like

play11:24

in this position

play11:25

so just click this go to x and y

play11:28

position now great

play11:29

now we have to apply a check that is

play11:32

forever lee

play11:33

foreverly we have to check

play11:36

we have to check what if this boat

play11:38

touches this

play11:40

rocks or this border so it will change

play11:42

its costume to uh

play11:44

backdrop to the game or and the game

play11:45

will be stopped so for this we have to

play11:48

add an operator that is our block

play11:52

if this boat touches border or rock

play11:56

so we have to click on sensing if this

play11:59

boat touches touches water

play12:02

or touches

play12:06

that is what touches rock so

play12:10

we have to switch the backdrop to game

play12:13

war

play12:14

switch back drop to game over and it

play12:17

will stop all the game

play12:18

so just stop on that's great

play12:22

now we have to add some movement for our

play12:25

board sprite whenever we press the

play12:26

keyboard right arrow

play12:28

so it will move into the right direction

play12:30

whenever we

play12:31

we press the left arrow so it will move

play12:33

into the left direction for this we have

play12:35

to

play12:36

add another when flag block and we have

play12:39

to add another

play12:40

forever block and we have to eat if else

play12:44

block for our

play12:45

moment so that's great whenever

play12:49

the key space pressed whenever the right

play12:52

arrow pressed

play12:53

so it will change the costume

play12:56

switch costume to right so it will the

play12:59

right costume will be

play13:01

appear and move five steps

play13:05

whenever we change the or press the

play13:08

right arrow so it will move into five

play13:10

steps and it will change the costume

play13:12

otherwise it will be in the original

play13:16

costume that is up

play13:19

up costume that's great now we have to

play13:22

add another uh

play13:23

condition that is whenever we press left

play13:25

arrow

play13:26

so for this we have to apply if

play13:29

condition

play13:30

and whenever the left arrow pressed

play13:34

the left arrow press so switch cost two

play13:37

two

play13:38

switch costume to left and move into

play13:42

minus five steps so it will move into

play13:45

minus five steps

play13:46

so that's great

play13:50

okay we have to just change this left

play13:52

arrow so

play13:53

whenever the left arrow has been placed

play13:55

so just left

play13:56

so now we have to try it so that's great

play13:59

so it's moving okay now we have to play

play14:02

into the full screen mode

play14:03

that's great you can see it here

play14:07

it's moving like a rock and whenever it

play14:10

touches the border

play14:11

so it will come back to this position

play14:16

and whenever it's run to

play14:19

flag so that's great you can see it here

play14:24

it's moving like smooth direction

play14:26

whenever it's

play14:27

moving to this that's great so if this

play14:30

video helped you please do subscribe

play14:32

our channel and please like our video

play14:34

for more informative videos please do

play14:36

subscribe

play14:38

thanks for liking

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Scratch CodingGame DevelopmentBoat GameEducational ToolCoding TutorialGame MechanicsVisual ProgrammingInteractive GameScratch 3.0Coding for Kids