forked from mozilla/BrowserQuest
-
Notifications
You must be signed in to change notification settings - Fork 219
Mathieu edited this page Jun 30, 2022
·
5 revisions
client/js/npc.js defines the Npc class, which uses the NpcTalk array that stores for each character the sequence of sentences it is supposed to produce to players.
The Npc class extends class Character
-
NpcTalk
: Each talking npc is associated to a cell in the array, its content is an array with the sentences to produce in the order in which they are to utter them.
-
init
: initialises the npc; -
talk
: displays the next sentence associated to the character in the NpcTalk table.
-
The class can be modified with a condition for each sequence so that the message of the character changes depending on who asks when (depending on achievements, the worn armor, etc.)
-
It could also be modified to provide multilingual support.