In my last post I explained how to program a sprite to move around in a game. Today I will be showing you how to change the speed of the sprite and how to change and add costumes let’s get started.
To change the speed of the sprite you simply have to decrease the amount that the x and y position of the sprite are changing. For example if my sprite is moving by 10 x each time the right arrow is pressed then to slow the sprite down we have to make the sprite only move 7 x each time the right arrow is clicked.
Next I will go over how to add a starting position for your sprite. To do this you have to drag out a block that says go to and has an x and a y input.
Now from personal experience in making countless games I know that there are usually only 3 places that a sprite starts at. Location 1 is the bottom of the screen also known as the edge of the screen. Location 2 is the left hand side of the screen usually in the middle. And Location 3 is at 0,0 or the dead center of the screen.
To make the sprite go to one of these 3 main locations we use the go to block and we insert it into our code we had from my last post. Since I want my sprite in the middle of the screen I will have the coordinates in the go to block at 0,0.
Finally I will be showing you how to change and add costumes in your game to make it visually pleasing. To do this we will add another (if then) block to our code as well as a (key space pressed?) block and finally we will add a (next costume) block. This will change the costume of scratch cat into a wizard but we have to add a (wait 1 second) block to make the change smooth.
After we add all this code it will look like this. Once again thank’s to everybody who read this entire blog entry and please comment any tips or ideas that you want to see me post about and make sure to include your real name or your scratch name. And make sure to check back soon for my next post which will include the start of making one of my all time favorite games 2 player battler simulator