How to Make a Role-Playing Game

Материал из Поле цифровой дидактики

Role-playing games, sometimes abbreviated as RPG, are 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 role-playing game with top-down scrolling.

Movement

Movement is one of the most basic scripts in a role-playing game. This script will control the player with the arrow keys, and stop when the player hits a black wall.

Basic Movement

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

Scrolling Movement

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.

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

See Also