(Note: The “change x by ()” block moves your character left and right, while the “change y by ()” block moves your character up and down.) Then add a “forever” block below it and place an “if () then” block inside the forever block.(Blocks inserted in this way create what’s called a Forever Loop, which means it constantly loops through blocks during gameplay).Īs you can see, to make your character jump, you’ll need to add a “key () pressed? then” block to select the “up arrow” for jumping. To begin, drag in a “when green flag clicked” block. To make your character jump, use the above code. Step 3: Make Your Character JumpĬan’t have a game if your character stands still, right? Let’s get it moving! Towards the bottom of the script, the “change y by” contains “gravity” (falling), while the “change x by” contains “x velocity” (horizontal speed). Insert the various other blocks (with corresponding values) as shown in the above image. Then add a “forever” block to the bottom of it. Start with a “when green flag clicked” block. One is “gravity” (which holds the value strength of falling) and “x velocity” (which holds the value of horizontal speed). This will allow your character to move along the ground, onto platforms, jumping in the air, and falling back onto the ground during gameplay.įor gravity, there are two new variables. It controls your character’s tendency to fall off of platforms and other obstacles (as well as determining whether it’s on the ground, platform, or in the air.)Ībove, there’s a simple block script for your platformer sprite. Gravity is an important element for any platform game. Got your sprites ready? Awesome! Step 2: Create Simple Sprite Script Start with two or three to keep things simple. Name this “platform 1” and duplicate it for new platforms (“platform 2” and so on). Select a new sprite and draw your first platform. This is what makes a platformer game fun! Keep in mind that you can make different (and unique) shapes as you get more comfortable building your own games. Draw a ground block that fills the bottom width of the drawing window.įinally, create simple horizontal platforms on which to run, hop, and jump. Select a new sprite and rename it “ground” for clear labeling. Check out how to make a sprite move to freshen up on scripts with Scratch blocks! You’ll need to program your new character for movement. Decrease size of player to allow room for moving around the game screen. Rename “sprite” to “player.” Then, delete the Scratch Cat with a right click (if you’re not using). (You can also switch costumes to add even more customization.) To select a new one, click the button labeled “Choose a Sprite” located in the lower right corner of your screen. Check out the Scratch Wiki for a great introduction to sprites and more about Scratch 3.0!įeel free to use the Scratch Cat or another premade sprite. In a platformer, sprites are used to create a character, ground, and platforms. Ready to make your first basic platformer game? Good luck! Platformer Game Tutorial Step 1: Make Your Sprites Once you get the hang of the basics, it’s simple & fun to make a game in Scratch!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |