WarriorJS Docs
  • اللاعب
  • الصانع
  • المجتمع
  • العربية
    • English
    • Català
    • Čeština
    • Deutsch
    • Ελληνικά
    • Español
    • Français
    • Italiano
    • Polskie
    • Русский
    • Српски језик (Ћирилица)
    • Svenska
    • Türkçe
    • 中文
    • 繁體中文
    • ساعد في الترجمة
  • GitHub

›الدليل

الدليل

  • المقدمة
  • إنشاء البرج الخاص بك
  • إضافة مستويات
  • تحديد القدرات
  • تعريف الوحدات
  • إعادة بناء التعليمات البرمجية
  • الاختبار
  • نشر

صانع الـ API

  • حيز الـ API
  • وحدة API
Translate

إضافة مستويات

المستوى هو نص برمجي أخر من جافا سكريبت:

const Level1 = {
  // Level definition.
};

دعونا نبدء بكتابة الوصف والتلميحات للمستوى الخاص بنا:

const Level1 = {
  description:
    "You've entered the ancient castle of Eastwatch to escape from a blizzard. But it's deadly cold inside too.",
  tip:
    "Call `warrior.walk()` to walk forward in the Player's `playTurn` method.",
};

علينا كذالك تحديد رقمين: مكافأة الوقت ودرجة الأس(ace). مكافأة الوقت يكتسبها اللاعب بناء على سرعة إكمال المستوى ( يتناقص من دور إلى دور حتى يصل الى الصفر). درجة الأس، من ناحية أخرى، يتم استخدامه لحساب درجة المستوى ( في وضع الملحمة فقط). أية درجة أكبر أو مساوية لدرجة الأس ستحصل على درجة S. دعنا نضيف هذه الأرقام:

const Level1 = {
  description:
    "You've entered the ancient castle of Eastwatch to escape from a blizzard. But it's deadly cold inside too.",
  tip:
    "Call `warrior.walk()` to walk forward in the Player's `playTurn` method.",
  timeBonus: 15,
  aceScore: 10,
};

هذين الرقمين يجب تعديلها جيدا عند اللعب لتجريب البرج. لهذا الدليل، لقد قمنا بذالك من قبل.

الشئ التالي الذي يجب القيام به هو تحديد أرضية المستوى، بدءاً بحجمها:

const Level1 = {
  description:
    "You've entered the ancient castle of Eastwatch to escape from a blizzard. But it's deadly cold inside too.",
  tip:
    "Call `warrior.walk()` to walk forward in the Player's `playTurn` method.",
  timeBonus: 15,
  aceScore: 10,
  floor: {
    size: {
      width: 8,
      height: 1,
    },
  },
};

و بعد ذالك، نحن نحتاج إلى تحديد موضع السلالم لكي يستطيع المحارب الانتقال للمستوى المقبل:

const Level1 = {
  description:
    "You've entered the ancient castle of Eastwatch to escape from a blizzard. But it's deadly cold inside too.",
  tip:
    "Call `warrior.walk()` to walk forward in the Player's `playTurn` method.",
  timeBonus: 15,
  aceScore: 10,
  floor: {
    size: {
      width: 8,
      height: 1,
    },
    stairs: {
      x: 7,
      y: 0,
    },
  },
};

وفيما يخص المحارب، دعنا نُعَرف المحارب لهذا المستوى:

const Level1 = {
  description:
    "You've entered the ancient castle of Eastwatch to escape from a blizzard. But it's deadly cold inside too.",
  tip:
    "Call `warrior.walk()` to walk forward in the Player's `playTurn` method.",
  timeBonus: 15,
  aceScore: 10,
  floor: {
    size: {
      width: 8,
      height: 1,
    },
    stairs: {
      x: 7,
      y: 0,
    },
    warrior: {
      character: '@',
      maxHealth: 20,
      position: {
        x: 0,
        y: 0,
        facing: 'east',
      },
    },
  },
};

و بهذا، يكون المستوى قد إكتمل. لكن قبل المتابعة، دعنا نحدد المستوى المقبل:

const Level2 = {
  description:
    'The cold became more intense. In the distance, you see a pair of deep and blue eyes, a blue that burns like ice.',
  tip:
    "Use `warrior.feel().isEmpty()` to see if there's anything in front of you, and `warrior.attack()` to fight it. Remember, you can only do one action per turn.",
  clue:
    'Add an if/else condition using `warrior.feel().isEmpty()` to decide whether to attack or walk.',
  timeBonus: 20,
  aceScore: 26,
  floor: {
    size: {
      width: 8,
      height: 1,
    },
    stairs: {
      x: 7,
      y: 0,
    },
    warrior: {
      character: '@',
      maxHealth: 20,
      position: {
        x: 0,
        y: 0,
        facing: 'east',
      },
    },
  },
};

بعد أن بدأت الأمور تصبح أكثر تحديا للاعب، هذه المرة أضفنا أدلة. الأدلة اختيارية و ستظهر فقط عند الطلب.

الآن نحن بحاجة إلى إضافة مستويين إلى البرج. تتم إضافة المستويات المستويات ترتيب البرج:

module.exports = {
  name: 'Game of Thrones',
  description:
    'There is only one war that matters: the Great War. And it is here.',
  levels: [Level1, Level2],
};

رائع! لكن كما لاحظتم، لقد أمرنا اللاعب بإستدعاءwarrior.attack()، warrior.feel()، و warrior.walk() لكن لم ندرس المحارب كيفية القيام بأي من هذه الأمور. دعونا نفعل هذا الآن!

← إنشاء البرج الخاص بكتحديد القدرات →
WarriorJS Docs
Docs
PlayerMaker
Community
SpectrumTwitterFollow WarriorJS on Twitter
More
DonateGitHubStar