Skip to main content

Posts

Showing posts from 2023

How to make a Tic-Tac-Toe Game in Scratch

Hello Scratch players, today we are happy to announce that we have released the first step-by-step tutorial on how to create a Tic-Tac-Toe game in Scratch!

Jump

Welcome to this exciting tutorial where we will dive into the world of Scratch programming to create a jump functionality for your games or animations! Throughout this tutorial, I am going to guide you step by step so that even if you are at the very beginning of your coding journey, by the end, you will have a functional jump mechanism that you can implement in your own Scratch projects. You'll use essential coding concepts like loops, conditionals, and variables, all of which are not just core to Scratch, but to programming as a whole. Let's go then to https://scratch.mit.edu/ and create new project. As always when starting new project Scratch add cat sprite to the stage. Lets select a sprite and go to the code area. If you are not familiar with Scratch interface check my previous article about it. We will start with a fairly simple approach. After clicking jump key, space in our case is going to move sprite up on x-axis and then down. Our code should looks similar to one...

List operations in Scratch

Hey Scratchers. During our adventure with Scratch, we have already learned that variables can be used to store data in applications. Today we would like to show you how to work with lists. In short, a list is a data structure that contains a collection of elements. We will learn basic list operations and after these exercises you should be ready to use it in your applications. To create a list, click the Variables button and Make a List button. We add a name for our list as names . Then we observe an interesting thing. A list with a set of possible operations has been added to Scratch. In the preview section we can observe that Scratch added graphic component and thanks to it, we will be able to observe all the elements in the list. Now, if we want to add some elements to list, we need to drag and drop add… to... component. When our program runs, we want to clear everything, so every time we click the green flag we will get the same result. You can see that the code adds 3 names to ...

Bouncing ball

Hello! today we want to play with physics! If you want to stop reading because you hate physics classes, then... I promise that everything we talk about today will be extremely simple and fun! Today we throw a ball and if we think about throwing any objects, one term comes to mind: gravity ! So we can imagine it as an invisible force that attracts objects towards itself. If we think about Earth's gravity, of course it attracts objects to the ground. I mentioned we were going to throw the ball, right? Let's look at the final result of today's work. As usual, before we jump into coding, we need to draw our objects. Today, we will import them! On the right side, click Backdrops and select one of the existing ones called Blue Sky . We repeat the same for the sprite. We want to have the ball. So let's go through the sprite gallery in Scratch and find one called Baseball . Once added, let's rename it to Ball . Now it’s time for coding! We start from adding 4 variables: b...

Text animation

Today we will take the next step in our exciting journey as a Scratch developer. This time we will play with text animation. Our goal is to enlarge individual letters when you hover the mouse over them. In addition, we will use the effects component available in Scratch to make our animation look even fancier. Before we go into the details, let's check the end result. The first step is to create four sprites. Each of them will represent an individual letter of the word DEVS . Each letter must have its own dedicated color. We will choose the following letter colors: D – green E – yellow V – red S – blue The outline should be gray and size 1. We need to save the current zoom value for each individual letter. Let's create a new variable called zoom for the first sprite D. Traditionally, we run the script by clicking the green flag. We assume that the initial size of the letter is 50. In the foreach loop, when the sprite is hovered over, we want to increase its size by 2 until th...

Cloning sprites

 I guess that you already know what sprites in Scratch are, but have you been thinking whether it is possible to create a new sprite from the code blocks level? The answer is YES thanks to concept called clones. In the programming language Scratch, a clone is a copy of a sprite, which is an object that can be animated and interacted with. When you create a clone of a sprite, you essentially make a duplicate that can behave independently from the original.  To understand it better let's imagine we have a sprite called "Particle" in Scratch, and we want to create a particle effect. First, we'll create the code for the original particle. We can make it move randomly around the screen, change color, or do any other desired effect. The end result should looks like that: Let's start with creating variables for our particles. We need variable to store vertical and horizontal speed but also ghost effect (transparency) of the pieces. What is important here, when creating v...

How to create spinning fan in Scratch!

In today's post we will learn how to create one of the most popular animations used in games and applications called rotation. We will create a spinning fan that you probably remember from your childhood. Before we move on to the Scratch environment, we can take a look at the end result. Our animation will consist of two sprites: a fan and wings. You can imagine that the fan will act as a plastic stick that holds the paper fan wings. Let's create a fan sprite and draw it in a rectangular shape. We will create a total of four wings. To form the first one, we need to create a triangle. We need to use the Rectangle and Reshape tools. Once we have the first triangle, we need to clone it and move both close to each other. Once we have the first wing, we need to repeat the same operations to create a distinctive trio. Don't forget to change their colors to make the fan look more colorful and attractive. When our fan and wing sprites art will be ready. We need to move them so tha...