How to Make an RPG Overworld

Материал из Поле цифровой дидактики
Версия от 11:33, 21 июля 2022; Patarakin (обсуждение | вклад) (1 версия импортирована)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)

An RPG overworld is the map or background of an RPG project. It can often scroll with the main character's movement to allow the viewer to travel among a rather large world. Other objects such as enemies in the world need to therefore have positions relative to the scroll of the background. The player's perspective is looking down at the character, rather than the player looking at the character from the side. Шаблон:Note

Main Idea

In the RPG, the player figuratively moves but remains with a static x and y position. The world that is visually behind the character moves opposite the character due to the limitations of the stage's size compared to the world's.

Main Character Movement

Assuming scrolling is utilized for the gameplay, the following script can be placed in the main character sprite to scroll the background:

whenclickedorduringamomentmovementispropergotox:0y:0centersthecharacterforeverifkeyrightarrowpressed?thenchangescrollxby-1to"move"right,scrollthebackgroundleftendifkeyleftarrowpressed?thenchangescrollxby1endifkeyuparrowpressed?thenchangescrollyby1endifkeydownarrowpressed?thenchangescrollyby-1end

Making Boundaries

Boundaries set limits on how far the world can be scrolled. The player sprite, who controls all scrolling, can have a modified script shown below to set boundaries of the world:

whenclickedorduringamomentmovementispropergotox:0y:0centersthecharacterforeverifkeyrightarrowpressed?andscrollx>-960then-960istheboundarychangescrollxby-1to"move"right,scrollthebackgroundleftendifkeyleftarrowpressed?andscrollx<960thenchangescrollxby1endifkeyuparrowpressed?andscrolly<720thenchangescrollyby1endifkeydownarrowpressed?andscrolly>-720thenchangescrollyby-1end

Enemy Movement

Enemies in an RPG often move to bring more excitement and challenge to the game. An enemy who remains still may not be as difficult to defeat as one who moves. Enemies must scroll with the over world because only the main character remains in a static position. When the world scrolls due to the player's movement, the enemy has to scroll with the background to justify the movement properly. The first step is to create the enemy sprites, which can be drawn in the paint editor or imported. Enemies may have movement that differs from one another. To generate random movement in the over world, the following script can be used or relate to one's needs:

whenIstartasacloneassumingtherearemultipleenemiesgotox:pickrandom-220to220y:pickrandom-160to160generatesneartheplayersetoffxtoxposition-scrollxjustifiesxpositionwiththebackgroundsetoffytoyposition-scrollyjustifiesypositionforevergotox:scrollx+offxy:scrolly+offyifypositionofcharacter<ypositionthenifcharacterbelowenemychangeoffyby-2movesdownendifypositionofcharacter>ypositionthenifcharacteraboveenemychangeoffyby2movesupendifxpositionofcharacter<xpositionthenifcharacterleftofenemychangeoffxby-2movesleftendifxpositionofcharacter>xpositionthenifcharacterrightofenemychangeoffxby2movesrightend

Create a variable named "battle". When the battle starts, this will keep the battle from repeating over and over again. Lastly, use these scripts:

whenclickedforeveriftouchingenemy?andnotbattle=1thenbroadcastbattleMakethisthebroadcastthatstartsthebattlesequence.setbattleto1endend

See Also