| This article or section may not have content matching Scratch Wiki editing standards. Please improve it according to Scratch Wiki:Guidelines and Scratch Wiki:Editing Conventions. (November 2015)|
Reason: please look at other tutorials to get a sense of how a tutorial looks
|This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (December 2015)|
RPGs (role-playing games) generally feature a single or multiple playable characters who are guided on a quest through a world full of enemies. They usually are played from a top-down perspective.
This tutorial will show how to make a top-down RPG.
Movement is one of the most basic scripts in an RPG. This script will control the player with the arrow keys, and stop when the player hits a black wall.
This is the more basic method of movement that can be used.
When gf clicked go to x: (0) y: (0) forever if <key [up arrow v] pressed?> then Change y by (7) if <touching color [#000000]?> then Change y by (-7) end end if <key [down arrow v] pressed?> then Change y by (-7) if <touching color [#000000]?> then Change y by (7) end end if <key [left arrow v] pressed?> then Change x by (-7) if <touching color [#000000]?> then Change x by (7) end end if <key [right arrow v] pressed?> then Change x by (7) if <touching color [#000000]?> then Change x by (-7) end end
|Note:||Using this method of detection, good timing will allow somebody to "clip" into the wall, and move around freely by pressing the arrow opposite the direction they want to go. Also, using this method the only way to get to places beyond the view of the window is using a new background in which the background changes when the sprite reaches the edge and it teleports the sprite to the other edge.|
This is a more advanced method of movement in which the player stays centered, but the background moves, giving an impression of the player moving. It is more commonly found in popular RPGs (e.g. Pokémon), but can be harder to make.
In order to make scrolling movement, some sprites and variables are needed:
- Character sprite
- Background sprite (one costume for each full screen of background)
- Set the backdrop to the color that blocks motion
- Private variable for the background sprite: CloneID
- ScrollX variable