Programming and Creating Games

back
1 /365 Days
The Heroes Positions in the Stage

 

Video – The Heroes Positions in the Stage

Video Transcript

Hello

The following courses refer to very important programming concepts.

Their knowledge will help you build strong foundation in order to understand computer programming.

All you have to do now is to freeze this video and open Scratch in another window.

It is essential to try anything that Stevie suggests. This is the only way that will help you achieve the goals of this lesson.

Remember that the more time you spend with this application the better you become!

So remember. We often freeze the image and try at Scratch.

Stevie you can start ..

 

Hello

The programming concept we will discuss in this lesson is the “coordinates”.

Coordinates are a very important programming concept as they determine the location of sprites in the stage.

Understanding them will help you create games using scratch.

Gas! I will need your help with the screen.

The scratch stage has 480 pixels length and 360 pixels height.

In order for the programmer to determine the precise location of a sprite in the scene, he should accurately specify its coordinates.

The coordinates are 2 numbers. The first number, named X, defines the horizontal position of the sprite in the stage.

The second is named Y and defines the vertical position of the sprite in the stage.

The values that the X coordinate can take are between -240 and 240.

If it has a -240 value then it is somewhere on the far left of the stage.

If it has a value of 0 is in the middle of the stage and if it has a value of 240 it is on the right edge of the stage.

The corresponding values of the Y coordinate are from -180 to 180.

If the sprite has a value of Y = -180 then its position will be at the lower end of the stage and if it is 180 at its upper end.

To determine the exact location of a sprite, we specify its coordinates as a pair.

The position (0,0) means that X = 0 and Y = 0 and is located exactly in the center of the stage.

Now let's move on to the scratch program to see how things work in practice.

As soon as the program starts, it is in the new project by default,

Here you 'll find a sprite named: "Sprite1". It is our well-known cat.

The name of the item is visible here and we can change it if we want.

Usually we change the name of each item that we use according to its shape.

Let's change it to "cat".

Note how the cat's position seems to be in the center of the stage.

Its exact position is determined, as we previously mentioned, from its coordinates.

As you can see, it's at 0.0.(zero point zero)  That is precisely in the center of the stage.

I can use my mouse to move the cat to whatever point I want on the stage.

Watch how the X and Y values change as i move it.

Let me leave it here.

Let me now try to change the position of the cat by creating a scenario for it.

The blocks I use are blue.

I will try to experiment for a while with these instructions.

After watching my moves I recommend you do the same in your own Scratch

window.

Music please ...

 

 

 

 

Comments